|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Populate Select List from JS
Hello everyone,Bruce Sorge 08/12/12 01:50 P > Hello everyone,Chris Hardman 08/16/12 01:23 P > Hello everyone,Chris Hardman 08/16/12 01:24 P Actually this code worked once I corrected the spelling of a variable. Sorry I did not update the list.Bruce Sorge 08/16/12 01:31 P Hello everyone, So yesterday I figured out the JavaScript for my two selects. In the JS code below I have the information I need, Resort Name and Resort ID: <script type = "text/javascript"> function setOptions(opt) { var resortID = document.adminForm.resortID; resortID.options.length = 0; if ((opt == "0") || (opt == "1")){ resortID.options[resortID.options.length] = new Option(""); } if ((opt == "2") || (opt == 2)) { <cfoutput query="qSelectResorts"> resortID.options[resortID.options.length] = new Option('#Resort_Name#','#resort_ID#'); </cfoutput>} } </script> Here are the select lists: <select name="adminID" size="1" style="width: 150px" onchange="setOptions(document.adminForm.adminID.options[document.adminForm.adminID.selectedIndex].value);"> <option value="0" selected>Select...</option> <option value="1">Site Admin</option> <option value="2">Resort Admin</option> </select> <br /> <br /> <select name="resortID" size="1" style="width: 150px" ><option value = "0"> </option></select> The first list is hard coded as you can see and teh second one is dynamic. When you select Resort Admin then the second list populates with the resort names. What I need now is to get the resort ID's in the value and I don't know how to do that. If anyone can help me with this last part I would really appreciate it. Thanks in advance, Bruce ----- Excess quoted text cut - see Original Post for more ----- Bruce AJAX might be better here. Actually this code worked once I corrected the spelling of a variable. Sorry I did not update the list. BRuce >> > Bruce > > AJAX might be better here.
|
June 18, 2013
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||