View Full Version : Help! combobox NOT updating

03-16-2009, 09:04 PM
Hi Please help, i am terribly confused and never encountered this before.

I have a search screen which based on the dropdown box choice, displays fields, name address etc.

So i select the dropdown box and choose "First Name / Last Name". I input values into the newly displayed FName and LName text boxes that are displayed.

Search executes and returns values, the Combo Box displays "First Name / Last Name". However I want it to return to the default Combo Box value.
(This is coming from the lead not me i know its foolish).

So i use
var selection = document.getElementById("ComboBox0");
selection.selectedIndex = 0;

and if I run AFTER the above line

I see 0 and Default

BUT the text within the combo box is still displayed as "First Name / Last Name"

what am i doing wrong here?

Old Pedant
03-16-2009, 10:56 PM
Not enough code.

Perhaps something is changing the selection *AFTER* you change selectedIndex to zero.

We can't tell from the fragment you posted.

WHEN, for example, do you set that selectedIndex to zero??? I would have assumed you might do it via <body onload=...> ??

03-16-2009, 11:19 PM
try checking the html using view source / view page source.
make sure that it isn't written like this :

<select name="ComboBox0" id="ComboBox0">
<option value="Default">First Name / Last Name

Old Pedant
03-16-2009, 11:20 PM
LOL! Good catch! Checking the .value doesn't really say anything about the displayed text. My hunch is that this is not the problem, but sure would be fun if it is!

03-16-2009, 11:41 PM
Its because I've seen scripts printing the first option with previous selection.
And as you've already said that there's not enough code to analyze the problem.