TheInsider
Programmer
Hello,
Is there a built-in method [that works in both IE and Netscape] to get the index of an item in a combo/listbox based on its value or text, other than using a for-loop?
In my onSubmit event I validate some user input, based on some criteria I may need to automatically select a certain option in a combo box. I am currently using a for-loop, but I don't want to re-invent the wheel. I know that I could use the following to do the selection:
However, the combo box data is loaded from a table and if records are added or subtracted from the table, the index will change.
Thanks,
TheInsider
Is there a built-in method [that works in both IE and Netscape] to get the index of an item in a combo/listbox based on its value or text, other than using a for-loop?
In my onSubmit event I validate some user input, based on some criteria I may need to automatically select a certain option in a combo box. I am currently using a for-loop, but I don't want to re-invent the wheel. I know that I could use the following to do the selection:
Code:
combobox.selectedIndex = [desired index]
Thanks,
TheInsider