Hi-
Ive been trying to get this to work but i cant
i have 2 fields and would like to populate the second field based on the first field's content using javascript ( so that there will be no return trip to the server)
say the fields are CarMake and CarModel
CarModel will reflect what is chosen as the make (eg. Toyota -- Camry, Rav4. Volkswagon- Beetle, etc)
i have the two fields on the form.
in the onFocus for CarMake i have:
and in the onChange i have:
i keep getting "undefined" in the box when i make a change.
i dont think the bottom part is right for declaring how to populate the CarModel field but it is the only thing i use that i get some kind of an input.
and advice?
Thank you,
Kara
Ive been trying to get this to work but i cant
i have 2 fields and would like to populate the second field based on the first field's content using javascript ( so that there will be no return trip to the server)
say the fields are CarMake and CarModel
CarModel will reflect what is chosen as the make (eg. Toyota -- Camry, Rav4. Volkswagon- Beetle, etc)
i have the two fields on the form.
in the onFocus for CarMake i have:
Code:
list = new Array ("BMW","Toyota","Volkswagon");
select = document.forms[0].CarMake;
len = list.length;
select.length = len;
for ( i = 0; i < len; i++) {
CarMake.options[ i ].text = list [ i ] ;
CarMake.options[ i ].value = list [ i ] ;
}
Code:
array = new Array
if (selection == "BMW") {
new Array ("Z3","Z5");
} else if (selection == "Toyota") {
new Array ("Rav4","Camry");
}
} else if (selection == "Volkswagon") {
new Array ("Beetle","Jetta");
}
pick = document.forms[0].CarModel;
len = list.length;
pick.length = len;
for ( i = 0; i < len; i++) {
CarModel.options[ i ].text =array [ i ] ;
CarModel.options[ i ].value = array [ i ] ;
}
i dont think the bottom part is right for declaring how to populate the CarModel field but it is the only thing i use that i get some kind of an input.
and advice?
Thank you,
Kara