doogie352
05-06-2004, 12:11 AM
This is probably an easy question, but I have tried for three hours to figure it out with no luck.
I am trying to use the Double Combo script (http://javascriptkit.com/script/cut183.shtml). The script runs great, but I need it to run twice within the same form on the same page. This causes any selection in either of the main categories to change the sub category in only the second set of boxes. I have changed the names of both the main and subcategories to no avail. I am guessing I have to make a change in the array, but I can't figure out what. The relevant code is shown below. I did not post the whole thing since it is over 800 lines. Any assistance would be greatly appreciated.
<select name="reason_section" size="1" onChange="redirect(this.options.selectedIndex)">
[the options for the main box are here]
<script>
<!--
/*
Double Combo Script Credit
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScripts here!
*/
var groups=document.form_216_1.reason_section.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
[the arrays are here]
var temp=document.form_216_1.reason_subsec
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
I am trying to use the Double Combo script (http://javascriptkit.com/script/cut183.shtml). The script runs great, but I need it to run twice within the same form on the same page. This causes any selection in either of the main categories to change the sub category in only the second set of boxes. I have changed the names of both the main and subcategories to no avail. I am guessing I have to make a change in the array, but I can't figure out what. The relevant code is shown below. I did not post the whole thing since it is over 800 lines. Any assistance would be greatly appreciated.
<select name="reason_section" size="1" onChange="redirect(this.options.selectedIndex)">
[the options for the main box are here]
<script>
<!--
/*
Double Combo Script Credit
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScripts here!
*/
var groups=document.form_216_1.reason_section.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
[the arrays are here]
var temp=document.form_216_1.reason_subsec
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>