View Single Post
Old 06-19-2002, 04:46 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
You have to manipulate the options, not the <select> element itself. For instance, you have selectedIndex is a property of the options array. That's why you should change your function call to

onChange="updateEmployeeFields(this.options[this.[b]options.[]selectedIndex].value)"

So now you've got the value of the currently selected option. And that value is not necessarily the index of the options array! To set another select list to the option that corresponds to the select option in the firs list, try sth. like

Code:
function updateEmployeeFields(whichValue){
	for(i=0;i<employeeFields.length;i++){
		
		inner: for (var j = 0; j < document.form1.elements[employeeFields[i]].options.length; j++) {
			if (document.form1.elements[employeeFields[i]].options[j].value == whichValue) {
				document.form1.elements[employeeFields[i]].options[j].selected = true;
				break inner;
			}
		}
		
	}
}
All out of my hand and from scratch, might need a little bit polishing, but the concept should be clear (I hope)
mordred is offline   Reply With Quote