How to use Glyphicon instead of datepicker text box - jquery-ui-datepicker

PFB the link of plunker .
http://jsfiddle.net/jomanlk/7NgpQ/
Here I want to use -
<span class="glyphicon glyphicon-calendar" id="full"></span>
instead of
<input type='text' id='full' name='fulldate'>
But if i use glyphicon, calendar is displaying on load only , i want to use it on selecting glyphicon icon only.Any pointers how to proceed on this.

Related

creating an if statement to look for specific button press

first time poster! I'm still fairly new to coding and Django...
I'm looking to create a django if statement to see if a certain button is pressed. I have a toast set up to show an error warning if a search returns no results, but it also pops up if the user clears the search.
Here's the button(s)
<div class="input-group-append">
<button class="form-control rounded-circle btn form-button ml-2" type="submit">
<span>
<i class="fas fa-search"></i>
</span>
</button>
<button class="form-control rounded-circle btn form-button ml-2 closebutton" type="clear" name="clear">
<span>
<i class="fas fa-times"></i>
</span>
</button>
</div>
I'd like it to spot if the button with the name/type "clear" is clicked, then it won't run the toast. Toast is below:
{% if button == 'clear' %}
<div class="toast custom-toast rounded-0 border-top-0" data-autohide="false">
<div class="arrow-up arrow-danger"></div>
<div class="w-100 toast-capper bg-danger"></div>
<div class="toast-header bg-white text-dark">
<strong class="mr-auto">Error!</strong>
<button type="button" class="ml-2 mb-1 close text-dark" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body bg-white">
{{ message }}
</div>
</div>
{% endif %}
I'd like it to spot if the button with the name/type "clear" is clicked, then it won't run the toast.
This if statement is only run on the server when it renders the HTML for the web page. It is checking if a variable named button has the string value "clear". This has nothing to do with any HTML elements in the page, let alone the name of a particular <button>. Instead, the value of the variable button comes from the "context" when your Python calls one of the render functions.
I'm looking to create a django if statement to see if a certain button is pressed.
There are two different ways to handle button clicks:
Submit a form to the server which then returns a response with a new page. This can be the same Django template rendered with different values in the context in order to get the behavior that you want.
Add an onclick handler to the button. This should be a JavaScript function that peforms the action you want. It can manipulate the elements in the page to add a toast or anything else.
The first option is very slow because it will require a new network request. The second option is probably preferred here since it will be very responsive to the user's actions.

pass my php variables to a bootstrap modal not working

in my page
foreach ($json->items as $sam) {
$link= $sam->id->videoId;
echo''.$link.'';
//its showing last 5 youtube video id ok.. i set every video id witha button for modal
echo'<button type="button" data-toggle="modal" data-target="#PlayModal" class="btn btn-outline btn-danger">Play</button>';
}
but when im trying to open a model by box in new winddow pop up there only show 1st video ID. modal not getting '.$link.' valu in popup window. modal code puting same page blew finish {}
echo'<div class="modal inmodal" id="PlayModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated bounceInRight">
<div class="modal-body">
<p>'.$name.'</p>
<div class="modal-footer">
<button type="button" class="btn btn-outline btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>';
According to the code given, even the first video should not play.
it is not printing the value of LINK inside the button, so it will not work.
Unless you have a JAVASCRIPT code observing the click and playing the video on click.
You can create the HTML code first manually containing the 5 video ID, and each video should have a button (according to your description), when clicked it will open the modal.
once that is done, you will be able to use php for each to properly echo the html code.
alternatively, the videos are in HTML list, and javascript will handle the event click, reading the video ID and passing to the player in the modal.
in either case, you need to understand the HTML structure first.

Add Icon to button in odoov8 Tree View

I need to add Icon to the button in a tree view
<button name="gen_link" type="object" icon="/custom_module/static/src/img/image.png" string="MyButton"/>
but as I inspect element in browser its shows me
<button type="button" class="" title="MyButton">
<img alt="MyButton" src="http://localhost:8000/web/static/src/img/icons//custom_module/static/src/img/image.png.png">
</button>
By default it always takes the default path, I am not able to give custom path for the icon.
Any Suggestion. . .
You can use /.. to move up /web/static/src/img/icons// directory.
Insert your button like this (tested):
<button name="gen_link"
type="object"
icon="/../../../../../../custom_module/static/src/img/image"/>

How can I add a twitter bootstrap span glyphicon into a button in html5?

I am creating an app in django and I have the next problem: I want to add a glyphicon into the next button:
<input class="btn btn-primary" type=button name="name" onClick="location.href='/location/'" value='I am a button'>
Concretely, I want the glyphicon to be with the text 'I am a button'. How can I do it?
Thank you!!!
instead of using input type button, you should try using button element
so something like this
<button type="button" class="btn btn-primary" onClick="location.href='/location/'">
<span class="glyphicon glyphicon-music"></span> I am a button
</button>
add the class as the icon class. For example class="glyphicon glyphicon-off for power button. Moreover remove the value of the button.

Selenium JUnit dropdown span item

I am a real beginner with Selenium and JUnit and trying to validate the functionality of a dropdown list by choosing one item. Selenium is recording it using the dynamic id, so when trying to rerun it, it cannot find the element.
I tried a few approaches in my JUnit code, but I can't seem to get it right.
It's a "View" dropdown list, where the first item is "Themes"
This is my html:
<div id="yui_3_16_0_1_1406046071286_1213" class="commontasks shaded">
<div id="pagetoolbar" class="hasnomsg hideReplyGroup">
<div id="match-messagelist-sizing">
<span id="btn-ml-cbox" class="btn btn-hdr cbox collapse-end-space" tabindex="0" aria-label="Select or deselect all messages [Ctrl+A]">
<span id="btn-select-dd" class="btn neoFocusable enabled" aria-label="Select or deselect categorized messages" aria-haspopup="true" role="button" data-action="select-dd">
<span id="btn-conv-view" class="btn btn-absolute btn-view-dd" data-action="menu" title="More view options" aria-haspopup="true" role="button">
<span id="yui_3_16_0_1_1406046071286_1215" class="icon-text">View</span>
<b id="yui_3_16_0_1_1406046071286_1212" class="icon icon-chevron-down"></b>
</span>
</div>
</div>
I tried using the following code to open the list:
driver.findElement(By.xpath("/html/body/div[7]/div[3]/div[4]/div[2]/div1/div[2]/div/div/span[3]/b")).click();
But when I'm running the test from Eclipse, it completes successfully, but I do not see the list opening. Is there a way to continue from here and choose an item from the list?
I tried using the Select option:
Select select = new Select(driver.findElement(By.xpath("/html/body/div[6]/div[3]/div[4]/div[2]/div1/div[2]/div/div/span[3]/span[text() = 'View']")));
But recieved the following error:
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span"
I would really appreciate your comments.
Thanks
Assuming that id (yiu-*) are dynamic, I am using CSS Selector. Try the below code:
driver.findElement(By.cssSelector("div#pagetoolbar b.icon-chevron-down")).click();
for your second question, you can use only SELECT element of HTML for the Select class. As the error clearly says you are trying to use it on a SPAN element.