...

View Full Version : double combo box in tables



ksuwyldkat
07-24-2002, 06:55 PM
I have one combo box in one cell of a table. I want it so that if you select the last option; then the options in another combo box in another cell changes. I have this so far but I keep getting the error: "document.number1.select_2.options" is null or not and object.

Here is what I have so far:

"<"Script Language = "Javascript">


var num_of_cats = 4; // This is the number of instructions, including the first, blank, category.

var option_array = new Array(num_of_cats);

option_array[0] = new Array("N/A",
"N/A");

option_array[1] = new Array("N/A",
"N/A");

option_array[2] = new Array("N/A",
"N/A");

option_array[3] = new Array("-- Select Return --",
"Small Biz",
"Corporate");


function switch_select()
{
{
for (loop = document.number1.select_2.options.length-1; loop > 0; loop--)
{
document.number1.select_2.options[loop] = null;
}

for (loop = 0; loop < option_array[document.number1.select_1.selectedIndex].length; loop++)
{
document.number1.select_2.options[loop] = new Option(option_array[document.number1.select_1.selectedIndex][loop]);
}

document.number1.select_2.selectedIndex = 0;
}
}
/Script


Table detail:


"<"td align="center" >"<"form name='number1'>
"<"font face="arial" size="2">
"<"select name='select_1' size="1" onChange="switch_select();">
"<"option>Please select an instruction
"<"option>Call
"<"option>Click
"<"option>Return
"<"/select>

"<"/form>
"<"/td>
"<"td>
"<"form name='number1'>
"<"select name='select_2' size="1">
"<"option >N/A

"<"/select>

"<"/form>

"<"/td>

Probably something silly I am missing.

tamienne
07-24-2002, 06:57 PM
well first thing i see right off is that the forms are named the same thing. you might either want it on one form or rename one of the forms.

ksuwyldkat
07-24-2002, 07:44 PM
I did try having the form tag after the body tag. The same combo boxes are repeated on the page. Like this image:

Combo Boxes

ksuwyldkat
07-24-2002, 07:49 PM
image is not posting for some reason, sorry.

ksuwyldkat
07-25-2002, 01:39 PM
Had this working for a second and then tried to do the same thing to the other sets. I had done so many variations that I forgot what I had done. I then tried to do a Shift Z and watch for it but now it does not work at all. Getting closer, I hope.:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum