<select id="dealer_information_city" name="dealer_information[city]" required="required"><option value="" disabled="disabled">Choose a city.</option>
<option value="23">California</option>
<option value="114" selected="selected">Los Angeles</option>
</select>
Here's my code i want to add a new option using crawler symfony but nothing happen anyone can help me thanks!
var_dump($crawler->filter('#used_car_step1_car_model')->addHtmlDocument('<option value="1">New Jersey</option>'));
Related
I have a page with a Select Option
but in my AMP Page i cant see this element,
What i need to add to this work?
For navigate the page use AMP.navigateTo
<select on="change:AMP.navigateTo(url=event.value)">
<option selected>-Select a Page-</option>
<option value="YOUR-PAGE-URL">Home Page</option>
<option value="YOUR-PAGE-URL">About Us</option>
<option value="YOUR-PAGE-URL">Camping Tips</option>
</select>
Using this bit of code in my wordpress theme:
<select name="archive-dropdown" onChange="document.location.href=this.options[this.selectedIndex].value;">
<option value="">Select month</option>
<?php wp_get_archives('type=monthly&format=option'); ?>
</select>
Taken from here: http://codex.wordpress.org/Function_Reference/wp_get_archives
This is the outputted code
<select name="archive-dropdown" onChange="document.location.href=this.options[this.selectedIndex].value;">
<option value="">Select month</option>
<option value='http://www.domain.com/?m=201307'> July 2013 </option>
<option value='http://www.domain.com/?m=201306'> June 2013 </option>
<option value='http://www.domain.com/?m=201305'> May 2013 </option>
</select>
For example, if I select July, the July archive page comes up and I checked that the address of the page is correct: http://www.domain.com/?m=201307
But the July option is not selected in the drop down. I understand that the bit of javascript in the onChange field is comparing the document href to the options and then selecting the matching option value, but it doesn't appear to be working.
Any help?
Figured it out creating a custom filter in my WordPress theme functions. Placed this in my theme's functions.php:
function get_archives_link_mod ( $link_html ) {
preg_match ("/value='(.+?)'/", $link_html, $url);
$requested = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
if ($requested == $url[1]) {
$link_html = str_replace("<option", "<option selected='selected'", $link_html);
}
return $link_html;
}
Then placed this in my theme's archive.php:
<form action="" method="get">
<select name="archive-dropdown" onChange="document.location.href=this.options[this.selectedIndex].value;">
<option value="">PICK MONTH</option>
<?php add_filter("get_archives_link", "get_archives_link_mod"); ?>
<?php wp_get_archives('type=monthly&format=option'); ?>
</select>
</form>
I basically took the code suggested here for highlighting the current link in the default list version of wp_get_archives() and modified it for the option format of the function. It took a bit of digging as a non-coder and posting it here is probably as consequential as a tree falling with no one around to hear it, but I'll just give myself a pat on the back and pretend it was someone else's hand in this sad and desolate world.
I have been searching the web for a result all day to solve my question...
I want a list of options, that would each link to a different image. However, instead of the image opening in a new window, I want the image to open in a lightbox on the same page (lightbox evolution for wordpress is the plugin I am using).
I have tried using onclick in input field, and the lightbox will open (if class="lightbox") but no image loads.
I don't know if I need to add a function that will allow the input to recognize which option is selected so that when the input button is clicked, that that specific image opens in a lightbox.
And if I do need a function, I don't know where to add the function... onclick? Somewhere in the option tag, or select tag?
<form>
<select>
<option value="linkimage1.jpg">image 1</option>
<option value="linkimage2.jpg">image 2</option>
<option value="linkimage3.jpg">image 3</option>
<input type="button" value="submit" />
</select>
</form>
Any help would be appreciated, even if it's to a good link that could explain how I could create a function and add it to my code, and then use a solution to call the function into my dropdown.
Thanks
If using iLightBox http://ilightbox.net/ you can do that like this:
<select id="selectImage">
<option>Select Image</option>
<option value="linkimage1.jpg">image 1</option>
<option value="linkimage2.jpg">image 2</option>
<option value="linkimage3.jpg">image 3</option>
</select>
<script>
jQuery(document).ready(function($){
$('select#selectImage').change(function(){
var $this = $(this),
url = $this.val();
$.iLightBox(url);
});
});
</script>
I have a html select control. I want to have a item which is a link to navigate to some other page, when it is selected with out postbacking.
Thanks in advance
How about this ?
<select onchange="location=this.options [this.selectedIndex].value;">
<option>- Select -</option>
<option value="http://www.google.com" >Google</option>
<option value="http://www.facebook.com" >Facebook</option>
<option value="http://www.stackoverflow.com" >Stackoverflow</option>
</select>
In functions php, this works like a charm:
<textarea name="menu1anchor" id="menu1anchor" cols="40" rows="1"><?php echo get_option('menu1anchor'); ?></textarea>
How can i make this drop down list work? I want to be able to input my values and select a desired one later on.
Right now, it does not matter which value I select, after i press "save changes" it does not send my value thru the form to wordpress options.
<select name="menu1" id="menu1">
<option value="1">Microsoft</option>
<option value="2">Google</option>
<option value="3">Apple</option>
</select>
Thank u!
<select name="menu1" id="menu1">
<option value="1"<?php selected(get_option('menu1'),1); ?>>Microsoft</option>
<option value="2"<?php selected(get_option('menu1'),2); ?>>Google</option>
<option value="3"<?php selected(get_option('menu1'),3); ?>>Apple</option>
</select>
Try that instead.