House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Populate Select List from JS

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
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
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bruce Sorge
08/12/2012 01:50 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bruce Sorge
08/16/2012 01:31 PM

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.  


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

June 18, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
             1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30             

Designer, Developer and mobile workflow conference