View Full Version : calling Chained Select Menu function in a loop

10-27-2009, 09:43 PM
1) Chained Select Menu


im trying to use the Chained Select Menu script in conjunction with data being populated from a database.

i have the data in javascript arrays containing the records ready for the chained list functions.
i use the following loop to go through the arrays and call the function for each record

for (var i=1; i<IdArray.length; i++) {

if(SonArray[i]== 0){
addList("First-Select", TitleArray[i], "", TitleArray[i]);
} else {
for (var x=1; x<IdArray.length; x++) {
if(IdArray[x] == SonArray[i]){

if(TitleArray[i] == "select") {
addOption(TitleArray[x], "- select -", LinkArray[i]);

} else if(LinkArray[i] == ""){

addList(TitleArray[x], TitleArray[i], "", TitleArray[i]);
} else {

addOption(TitleArray[x], TitleArray[i], LinkArray[i]);





it works, but.....not for all records being called by the "addList" function.it seems to skip every other record.(in Firefox more records are being shown)
what i suspect is that the function doesn't complete fast enough and the next one overwrites it.

does anyone have experience with these kind of issues.or a creative idea how to solve it ?