Click to See Complete Forum and Search --> : Javascript Array


taber13
September 8th, 2002, 02:30 PM
I have a VB Script Array defined by a database table, which then is converted to a Javascript Array which feeds some select boxes.
the code works with the following problem.
I am updating the text for the select boxes fine, but their values are not being passed.
I have one select box and upon selecting a value in the select box, the below function is ran. It toggles through the Array, to find the correct values which update another select box. This works fine, but when I try to use the form value of the below select box in my next selection, the value is null or not defined.

Any help would be greatly appreciated!!



function setturbtype()
{
var selturbmfgr = document.theForm.turbmfgr;
var selturbtype = document.theForm.turbtype;
var theturbmfgr = selturbmfgr.options[selturbmfgr.selectedIndex].value;
var theturbtype = selturbtype.options[selturbtype.selectedIndex].value;
selturbtype.options.length = 1;

for (i=0; i < arrturbinfo.length; i++)

if (theturbmfgr == arrturbinfo[i][0])
{
selturbtype.options[selturbtype.options.length]
= new Option(arrturbinfo[i][1]);
}
}

ShawnDev
September 8th, 2002, 07:26 PM
You are not specifying the value attribute of the Option tag you are creating:

selturbtype.options[selturbtype.options.length]
= new Option(arrturbinfo[i][1], someval);