I have gone through this and several other examples the code simply doesn't work when I pprint on the backend of django.
<select name="multiple-select[]" id="multiple-select" multiple>
<option value="1">Books</option>
<option value="2">Movies, Music & Games</option>
<option value="3">Electronics & Computers</option>
<option value="4">Home, Garden & Tools</option>
<option value="5">Health & Beauty</option>
<option value="6">Toys, Kids & Baby</option>
<option value="7">Clothing & Jewelry</option>
<option value="8">Sports & Outdoors</option>
</select>
When I select multiple items, the last item is what will be printed out not an array of items as expected.
Related
I have a dropdown with year values spanning 25 years, 10 years before the current year and 15 years after:
<select id="year">
<option value="">Select Year</option>
<option value="2011">2011</option>
...
<option value="2021">2021</option>
...
<option value="2036">2036</option>
<select>
This input is optional.
When the page loads, the control is to show Select Year.
The page that will be used by field users on a smartphone or tablet only.
Our research shows that in around 1 in 3 inputs, user will be required to select a previous year and the rest will be in the future.
I would like it so that when the user taps on the control, the displayed value starts at the current year so user can scroll forwards or backwards through the list rather than having to scroll through previous years if the value to be selected is in the future
Is this possible?
This might get you started, but it does have some issues, like as soon as you mouse over the drop down list, the "selected" item changes.
I suppose you'll have to add a if clause so it doesn't work at all times.
function setThisYear(selectEle) {
selectEle.value = "2021";
selectEle.options[selectEle.selectedIndex].value = 2021;
}
<select id="year" onclick="setThisYear(this)">
<option value="">Select Year</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2021">2021</option>
<option value="2031">2031</option>
<option value="2032">2032</option>
<option value="2033">2033</option>
<option value="2034">2034</option>
<option value="2035">2035</option>
<option value="2036">2036</option>
</select>
I am trying to simplify my code. I just cannot get things working the way i want.
I have 3 tables with 2 dropdown select options
Roadmap
Roadmap Years
Roadmap Years Releases
Selector 1 Roadmap
Selector 2 Roadmap Year
I have form with these 2 dropdowns
<select name="relation[id_roadmap]" id="id_portfolio" class="form-control col-auto form-control-sm autosubmit border-success" data-style="" data-width="100%">
<option selected value="">Select Roadmap</option>
</select>
<select name="relation[id_roadmap_year]" id="id_portfolio" class="form-control col-auto form-control-sm autosubmit border-success" data-style="" data-width="100%">
<option selected value="">Select Roadmap Year</option>
</select>
The other options are not relevant because i have no problem with them being set.
When i make the request with this they come empty in the input stream
How can i make the select option value to not come into the input
i've tried <option selected value>Select Roadmap Year</option> - this comes empty
i've tried <option selected>Select Roadmap Year</option> - this comes the text "Select Roadmap Year" instead of nothing.
What is the way to not come into the input stream ?
It is even possible to have them unset and not use code to unset them ?
<select name="relation[id_roadmap]">
<option selected="selected" disabled value="">Seleact Roadmap/option>
<option value="1">Roadmap 1</option>
</select>
This will not send the select value empty to the input stream
____ EDIT WITH Empty value ____
<select name="relation[id_roadmap]">
<option selected="selected" disabled value="">Select Roadmap/option>
<option value="">All Roadmaps/option>
<option value="1">Roadmap 1</option>
</select>
I am using an Applescript to tab to and select an item from a dropdown box on a form, and return to the starting field. Using Firefox 57.0, both "Cakes, large" (the first item with the first letter "C") and "Cocktails" get selected. Using Google Chrome 63.0 only "Cocktails" gets selected, which is what I want. Any ideas how to get the desired result in Firefox?
Applescript:
tell application "System Events"
tell application "System Events" to key code 48
tell application "System Events" to key code 49
keystroke "Cocktails"
tell application "System Events" to key code 48 using shift down
tell application "System Events" to key code 124 using command down
end tell
HTML code:
<div class="editor-field">
<select class="category-multi" id="RecipeTypes" multiple="multiple" name="RecipeTypes" style="display: none"><option selected="selected" value="85">Fried doughs</option>
<option selected="selected" value="64">Mousses, trifles, custards & creams</option>
</select>
<select class="form-control category-ddl" id="RecipeTypesDDL" name="RecipeTypesDDL"><option value=""></option>
<option value="41">Baked & steamed desserts</option>
<option value="42">Beverages / drinks (no-alcohol)</option>
<option value="82">Bread & buns, sweet</option>
<option value="43">Bread & rolls, savory</option>
<option value="44">Brownies, slices & bars</option>
<option value="45">Cakes, large</option>
<option value="46">Cakes, small</option>
<option value="47">Candy / sweets</option>
<option value="49">Cheesecakes</option>
<option value="50">Children & baby food</option>
<option value="51">Chili</option>
<option value="52">Chutneys, pickles & relishes</option>
<option value="53">Cocktails / drinks (with alcohol)</option>
<option value="54">Cookies, biscuits & crackers</option>
<option value="55">Crumbles, cobblers, crisps & bettys</option>
<option value="56">Curry</option>
I'm looking for a way to extract data from the available options from a website dropdown box, specifically the second optgroup "All fund companies".
extract of HTML code I'm scraping
</div><div class="large-5 medium-5 columns spacer-bottom padding-left-none"><div class="select_wrap"><select id="search-company" name="companyid" class="default">
<option value="">Search by company</option>
<optgroup label="Popular companies">
<option value="4">Hargreaves Lansdown</option>
<option value="1908">Lindsell Train</option>
<option value="55">Jupiter</option>
<option value="191">Legal & General</option>
</optgroup>
<optgroup label="All fund companies">
<option value="218">Aberdeen</option>
<option value="1080">Aberforth Unit Trust Managers</option>
<option value="141">Allianz Global Investors</option>
<option value="3472">Alquity Investment Management Limited</option>
<option value="1324">Amati Global Investors Ltd</option>
VBA:
Set htmlObj = html.getElementById("search-company")
For Each Child In htmlObj.getElementByClassName("optgroup")(1).Children
sqlId = Child.Value
sqlCompany = Child.innerText
Debug.Print (sqlId & " - " & sqlCompany)
Next
Thanks Jeeped...
This is the code that managed to solve the problem... not sure if it's the most efficient way of doing it, but it works :)
Set htmlObj = html.getElementById("search-company")
For Each Child In htmlObj.Children
If Child.Label = "All fund companies" Then Set htmlObj2 = Child
Next
For Each Child In htmlObj2.Children
sqlId = Child.Value
sqlCompany = Child.innerText
Debug.Print (sqlId & " - " & sqlCompany)
Next
I have a problem with a form select box on iPhones with bootstrap and I am looking for a way to fix this. For some reason when an option is selected and the user moves on to the next select box below on the form, the selected option clears and says 0 Items selected, being required fields, this stops the user being able to submit the form. This only happens on mobile devices, it works fine in a desktop browser.
The HTML is pretty bog standard stuff, these options are generated by PHP and I am using a Smarty template:
<tr>
<td class="title">Industry <span class="pink">*</span></td>
<td><select class="validate3" name="industry[]" style="width:200px;height:230px;" multiple >
<option selected="selected">Select an Industry</option>
<option value="1004" >Apprenticeships</option>
<option value="1035" >Building Services</option>
<option value="1007" >Construction & Property Jobs</option>
<option value="1010" >Energy Jobs</option>
<option value="1011" >Engineering Jobs</option>
<option value="1008" >Industrial Jobs</option>
<option value="1018" >IT & Telecoms Jobs</option>
<option value="1022" >Management & Executive Jobs</option>
<option value="1023" >Manufacturing Jobs</option>
<option value="1003" >Mechanical and Electrical</option>
<option value="1026" >Motoring & Automotive Jobs</option>
<option value="1027" >Public Sector Jobs</option>
<option value="1029" >Recruitment Consultancy Jobs</option>
<option value="1033" >Temporary Work Jobs</option>
<option value="1034" >Transport & Logistics Jobs</option>
</select></td>
</tr>
<tr>
<td class="title">Job Type <span class="pink">*</span></td>
<td><select class="validate3" name="job_type[]" style="width:200px;height:70px;" multiple >
<option selected="selected">Select a Job Type</option>
<option value="1001" >Permanent</option>
<option value="1002" >Temporary</option>
</select></td>
</tr>
As you can see I have a default option selected, which does not clear itself until the user tries to change it.
Here is the Smarty code incase it is a problem here:
<select class="validate3" name="industry[]" style="width:200px;height:230px;" multiple {if !empty($error.industry)}class="required-field"{/if}>
<option selected="selected">Select an Industry</option>
{section name="z" loop=$select_industries}
<option value="{$select_industries[z].id}" {get_value field=multiplelocation selectvalue=$select_industries[z].id fieldname="industry"}>{$select_industries[z].industry}</option>
{/section}
</select>
<select class="validate3" name="job_type[]" style="width:200px;height:70px;" multiple {if !empty($error.job_type)}class="required-field"{/if}>
<option selected="selected">Select a Job Type</option>
{section name="y" loop=$select_jobtypes}
<option value="{$select_jobtypes[y].id}" {get_value field=multiplelocation selectvalue=$select_jobtypes[y].id fieldname="job_type"}>{$select_jobtypes[y].job_type}</option>
{/section}
</select>