Hello
Im trying to dynamically populate a select box from another select box...
Here's the JS code:
<script type="text/javascript"�language="javascript">
function createSelectBox (subsection, section) { // populate subsection box
according to section box
// set up arrays
<cfloop query="sections">
<cfsilent>
<cfquery name="subsection" ...>
SELECT * FROM subsectionInSection WHERE section = '#sections.name#'
</cfquery>
<cfset first = 1>
</cfsilent>
var #name# = new Array(<cfloop query="subsection"><cfif NOT
first>,</cfif>"#subsection.name#"<cfset first = 0></cfloop>);
</cfloop>
// empty current items
for(i=subsection.options.length; i>=0; i--)
subsection.options[i] = null;
// set array to use
useArray = section;
// create new select
for(j=0; j<useArray.length; j++)
subsection.options[j] = new Option(useArray[j]);
subsection.options[0].selected = true;
}
</script>
And it's called here:
<select name="section" id="section"
onChange="createSelectBox(document.form.subsection,
this.options[this.selectedIndex].value);" >
The JS gets passed the name of the section I want, which corresponds to the
name of the array I want... The problem is that instead of outputting the
array it is supposed to, it outputs the name of the section with each
character in a new option...
How can I get it to output the array?!
TIA,
Ryan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4