Apologies for this but I've obviously been staring at my monitor too long...
When I run the following code in jsfiddle then only the first label/select and last label/select elements are displayed but not the middle one and I cannot see why
<body>
<form id="form1" runat="server">
<label id="a1" >City</label>
<select id="cityDropDownList" />
<label id="a2" >Property</label>
<select id="propertyDropDownList" />
<label id="a3" >Room Type</label>
<select id="roomTypeDropDownList" />
</form>
</body>
Thank you in advance.
Wrong using SELECT TAG
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
Becuse of you didn't close select tag, next tags were displayed improperly.
You asked for why it doesn't select the middle one.
Actually the selector of jquery works as it parsed html by tag.
It works for the first and third as it matches the "first and second" tag as single HTML SELECT TAG AS THERE IS NOT ENDING TAG for first tag. So third SELECT also works ... and fourth tag WILL not work :)
So write like this:
<select id="first_select"></select>
<select id="second_select"></select>
Related
I already apply <Required> tag in HTML <Select> but not working. The form is still able to proceed to the next step even not select anything at first step. Anyone know to solve it?
<label>Region :</label>
<select id="Region" class="custom-select form-control" required>
<option value="">Select Region</option>
<option value="central" id="Central">Central</option>
<option value="northern" id="Northern">Northern</option>
</select>
Have you declared your web page using HTML5? Make sure you declare the following statement at the beginning of the page
<!DOCTYPE html>
The required attribute is only available in HTML5 and only supported by specific browsers... w3schools Required Attribute
Having tested your original code in HTML5, it works.
You could get rid of the select option tag entirely, and place the value select option in the select tag itself.
<label>Region:</label>
<select value="Select Option" id="Region" class="custom-select form- control" required>
<option value="central" id="Central">Central</option>
<option value="northern" id="Northern">Northern</option>
</select>
Your code works it depends on the browser you use or the way that you are using it. I wrote a sample code for you. Hope it may help you:
<!DOCTYPE html>
<html>
<body>
<form >
<label>Region :</label>
<select id="Region" class="custom-select form-control" required>
<option value="">Select Region</option>
<option value="central" id="Central">Central</option>
<option value="northern" id="Northern">Northern</option>
</select>
<input type="submit">
</form>
</body>
</html>
So in the code above if you do not choose anything it will not let you submit.
So I have this like in a .jsp file:
<s:select name="dataObject.a" id="a" list="dataObject.aList" value="dataObject.a"/>
And the desired behavior is that the user's preference (stored at dataObject.a) would end up being the initial value of the select element on the page. However, despite the appropriate option in the select element having the attribute 'selected="selected"' it does not display as selected. Any thoughts? All browsers have this issue.
EDIT: Adding the generated HTML
<div class="row">
<span class="class1">
<label id="aLabel" class="labelPadding" for="a">A:</label>
</span>
<select name="dataObject.a" id="a">
<option value=""></option>
<option value="1" selected="selected">1</option>
<option value="2">2</option>
</select>
</div>
I have a code to select an option from a dropdown box which seems to work on one page of a website, but does not function on the other.
The code that works looks like this:
TAG POS=1 TYPE=SELECT FORM=NAME:quickOutputTemplate ATTR=NAME:saveToMenu CONTENT=$Save<SP>to<SP>Other<SP>File<SP>Formats
for this html:
<script type="text/template" id="quickOutputTemplate"> <input type="hidden" value="other" name="selectedQOFormat" /> <select class="saveToMenu" id="saveToMenu" name="saveToMenu" onchange="saveOutputForm('UA_output_input_form'); return false;"> <option value="enw">Save to EndNote online</option> <option value="endnote">Save to EndNote desktop</option> <option value="rid">Save to ResearcherID - I wrote these</option> <option selected="selected" value="other">Save to Other File Formats</option> </select> </script>
However when I try to use the same format:
TAG POS=1 TYPE=SELECT FORM=ID:cr_quickOutputTemplate ATTR=ID:cr_saveToMenu CONTENT=$Save<SP>to<SP>Text<SP>File
It does not work for this html:
<script type="text/template" id="cr_quickOutputTemplate"> <select class="saveToMenu" id="cr_saveToMenu"> <option selected="selected" value="other">Save to Text File</option> <option value="xls">Save to Excel File</option> </select> </script>
I have tried all the variations on this code that I can think of to make this work, but the macro just doesn't seem to be able to find the form. If any one has any ideas that might fix this, I would be very grateful to hear them.
Thanks
Try to use EVENT. Uncheck the ID recording option and record different types of drop downs. Then check which property in EVENT is changing and you can put there {{!LOOP}}.
I have a html structure like this
<form>
<div>
<select name="selectbox">
<option>option 1</option>
</select>
</div>
</form>
When I do a form submit, I do not see the values of that select, but if I put the select box outside of the div, it posts the value correctly. Any ideas?
That would be because you are missing the value attribute of the option tag. It should be:
<select name="variableName">
<option value="serverSideValue">DisplayText</option>
....
</select>
The text in between option is simply used for display to the user.
I m working on a application for mail sending and need to use select tag of HTML with showing multiple options (But select only one at a time).
I tried multiple='multiple' but it is showing only one option and arrow disappears form select box.
<select multiple="multiple">
<option>Volvo</option>
<option>Saab</option>
<option>Mercedes</option>
<option>Audi</option>
</select>
You may need to include a "size" in addition to the "multiple" attribute, in order to show more than one option at a time. Try something like this:
<select multiple="multiple" size="10">
<option value="...">...</option>
...
</select>
As an alternative, since you want only one option selectable, you could consider using a list of radio buttons. For example,
<input type="radio" name="auto" value="Audi" />Audi<br />
<input type="radio" name="auto" value="Honda" />Honda<br />
...