Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yet another combobox question

Status
Not open for further replies.

scooterDIVISION

Programmer
Feb 2, 2001
11
US
Here's the situation, the follwoing script works with three combo boxes, when I attempt to add the forth it generates the following errors, from the Netscape JS Debugger

Line 1591
thirdGroup[j] has no properties

(there would be 1994 lines with all the arrays populated)
The arrays are populated with a Cold Fusion Script.

haaaalllllpppppp!!!!


<!--- insane amounts of code below --->


<cfinclude template=&quot;../queries/qry_inv_picklist.cfm&quot;>
<html>
<head>
<title></title>

<SCRIPT LANGUAGE=javascript>
<!--
function initSelections()
{
var f
f = document.forms.nsnlookup
f.nsn.options[0].selected = true
f.EquipmentType.options[0].selected = true
f.Manufacturer.options[0].selected = true
f.Model.options[0].selected = true
}
//-->
</SCRIPT>
</head>
<body bgcolor=&quot;#FFFFFF&quot; onLoad=&quot;initSelections();&quot;>
<FORM name=&quot;nsnlookup&quot;>
<table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr align=&quot;center&quot;>
<td nowrap height=&quot;11&quot;>  
<select name=&quot;nsn&quot; size=&quot;1&quot; onChange=&quot;redirect(this.options.selectedIndex)&quot;>
<option selected>Select NSN First</option>
<cfoutput query=&quot;nsnpicklist&quot;>
<option>#nsn#</option>
</cfoutput>
</select>
<select name=&quot;EquipmentType&quot; size=&quot;1&quot; onChange=&quot;redirect1(this.options.selectedIndex)&quot;>
<option value=&quot;#&quot; selected>Select NSN First </option>
<option value=&quot;#&quot; selected>---Select2--------------</option>
<option value=&quot;#&quot; selected>---Select2--------------</option>
</select>
<select name=&quot;Manufacturer&quot; size=&quot;1&quot; onChange=&quot;redirect2(this.options.selectedIndex)&quot;>
<option value=&quot;#&quot; selected>Select NSN First </option>
<option value=&quot;#&quot; selected>---Select3--------------</option>
<option value=&quot;#&quot; selected>---Select3--------------</option>
</select>
<select name=&quot;Model&quot; size=&quot;1&quot; onChange=&quot;redirect3(this.options.selectedIndex)&quot;>
<option value=&quot;#&quot; selected>Select NSN First </option>
<option value=&quot;#&quot; selected>---Select4--------------</option>
<option value=&quot;#&quot; selected>---Select4--------------</option>
</select>

<script>
<!--

var groups=document.nsnlookup.nsn.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()

group[0][0]=new Option(&quot;Select NSN First&quot;,&quot;0&quot;);


<cfset j=1>
<cfset k=0>
<cfloop query=&quot;nsnpicklist&quot;>
group[<cfoutput>#j#</cfoutput>][<cfoutput>#k#</cfoutput>]=new Option(&quot;<cfoutput>#EquipmentType#</cfoutput>&quot;,&quot; &quot;);<cfset j=j+1></cfloop>
var temp=document.nsnlookup.EquipmentType


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=new Option(group[x].text,group[x].value)
}
temp.options[0].selected=true
redirect1(0)
}

var secondGroups=document.nsnlookup.EquipmentType.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup=new Array(group.length)
for (j=0; j<group.length; j++) {
secondGroup[j]=new Array() }}

<cfset j=1>
<cfset k=0>
<cfset l=0>

secondGroup[0][0][0]=new Option(&quot;Select NSN First&quot;,&quot; &quot;);

<cfloop query=&quot;nsnpicklist&quot;>
secondGroup[<cfoutput>#j#</cfoutput>][<cfoutput>#k#</cfoutput>][<cfoutput>#l#</cfoutput>]=new Option(&quot;<cfoutput>#Manufacturer#</cfoutput>&quot;,&quot; &quot;);<cfset j=j+1></cfloop>
var temp1=document.nsnlookup.Manufacturer

function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.nsnlookup.nsn.options.selectedIndex][y].length;i++){
temp1.options=new Option(secondGroup[document.nsnlookup.nsn.options.selectedIndex][y].text,secondGroup[document.nsnlookup.nsn.options.selectedIndex][y].value)
}
temp1.options[0].selected=true
redirect1(0)
}


<!-- FORTH GENERATION STARTS HERE --->


var thirdGroups=document.nsnlookup.Model.options.length
var thirdGroup=new Array(groups)
for (i=0; i<groups; i++) {
thirdGroup=new Array(group.length)
for (j=0; j<group.length; j++) {
thirdGroup[j]=new Array() }
for (k=0; k<group.length; k++) {
thirdGroup[j][k]=new Array() }
for (l=0; l<group.length; l++) {
thirdGroup[j][k][l]=new Array() }}

<cfset j=1>
<cfset k=0>
<cfset l=0>
<cfset m=0>

thirdGroup[0][0][0][0]=new Option(&quot;Select NSN First&quot;,&quot; &quot;);

<cfloop query=&quot;nsnpicklist&quot;>
thirdGroup[<cfoutput>#j#</cfoutput>][<cfoutput>#k#</cfoutput>][<cfoutput>#l#</cfoutput>][<cfoutput>#m#</cfoutput>]=new Option(&quot;<cfoutput>#Model#</cfoutput>&quot;,&quot; &quot;);<cfset j=j+1></cfloop>
var temp2=document.nsnlookup.Model

function redirect1(z){
for (n=temp2.options.length-1;n>0;n--)
temp2.options[n]=null
for (i=0;i<thirdGroup[document.nsnlookup.nsn.options.selectedIndex][z].length;i++){
temp2.options=new Option(thirdGroup[document.nsnlookup.nsn.options.selectedIndex][z].text,thirdGroup[document.nsnlookup.nsn.options.selectedIndex][z].value)
}
temp2.options[0].selected=true
}



function redirect2(z){
window.location=temp1[z].value
}
//-->
</script>






</td>
</tr>
</table>
</FORM>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top