Please stop cross posting.
"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com -----Original Message----- From: Robert L Nunez II To: CF-Newbie Sent: Wed May 30 20:44:46 2007 Subject: CF Headache Hello fellow Newbs and Experts, I have been trying to program CF Related Selects for the past couple of days now and i have it a major road block. After corresponding to various mailing groups and forums; I came across a site that would appear to contain the code that I needed for my web form. Unfortunately due to the way the form is set up, it is extremely difficult to do what I am attempting so I created an alternate Index file to test out my code. After much tweaking, I now error out on one line of code "StateArray#State#[#i#] = #HSName#;" And I have no idea what is wrong. I try to change it to "StateArray#State#[#i#] = #HSState#;" but then it only returns the states and no High School Names. I would appreciate any help that can be offered. Thank you The rest of my code is as follows: <!--- Select the states and area codes. ---> <cfquery datasource="DS" name="GetStates"> SELECT S.State, HS.HSState FROM States S, HighSchoolInfo HS WHERE S.State=HS.HSState ORDER BY S.State desc, HS.HSState </cfquery> <!--- Select all the area codes. ---> <cfquery datasource="DS" name="GetHighSchools"> SELECT HighSchoolInfo.HSCode, HighSchoolInfo.HSName, HighSchoolInfo.HSCity, HighSchoolInfo.HSState FROM HighSchoolInfo ORDER BY HSName </cfquery> <script language = "JavaScript"> <!-- // For each state, create an array to hold the area codes. // Each state array will be identified by the two-character state abbreviation <cfoutput query="GetStates" group="State"> // Create the array StateArray#State# = new Array(); <cfset i = 0> // Populate the array <cfoutput> <cfset i = i + 1> StateArray#State#[#i#] = #HSName#; </cfoutput> </cfoutput> // Function to populate the area codes for the state selected function PopulateHSName() { // Only process the function if the first item is not selected. if (document.OpenHouse.State.selectedIndex != 0) { // Find the state abbreviation var ThisState = document.OpenHouse.State[document.OpenHouse.State.selectedIndex].value; // Set the length of the arecode drop down equal to the length of the state's array document.OpenHouse.HSName.length = eval("StateArray" + ThisState + ".length"); // Put 'Select' as the first option in the area code drop-down document.OpenHouse.HSName[0].value = ""; document.OpenHouse.HSName[0].text = "Select"; document.OpenHouse.HSName[0].selected = true; // Loop through the state's array and populate the area code drop down. for (i=1; i<eval("StateArray" + ThisState + ".length"); i++) { document.OpenHouse.HSName[i].value = eval("StateArray" + ThisState + "[i]"); document.OpenHouse.HSName[i].text = eval("StateArray" + ThisState + "[i]"); } } } //--> </script> <form name="OpenHouse"> <p> <table border="0"> <tr> <td><b>State</b></td> <td><b>High School</b></td> </tr> <tr> <td> <select name="State" onChange="PopulateHSName()"> <option value="0">Select State <cfoutput query="GetStates" group="State"> <option value="#State#">#State# </cfoutput> </select> </td> <td> <select name="HSName"> <option value=""> <cfoutput query="GetHighSchools"> <option value="#HSCode#">#UCase(HSName)# -- #UCase(HSCity)#, #UCase(HSState)# </cfoutput> </select> </td> </tr> </table> </p> </form> -- Robert L Nunez II IS Technical Services Assistant University of Wisconsin-Milwaukee ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2777 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
