> > <td> <select name="cboWFMasPointTenth"
> > onChange="TestWFMasPointTenthfunction(this.value)">
[quoted text clipped - 26 lines]
>
> - Show quoted text -
Hi,
I have a combobox with values 1, 0, -1.
I want the selected item to equal the value in the database.
It may be 1, then the user changes it to 0.
You can 'read' the value from the database:
<option value=<%= rs.getInt(3)%> > </option>
How do you get the value in combobox to 'synchronise' with the
database. So if the value of rs.getInt(3) is 0.
The combox would have 0 selected.
PS got code for combobox & database from Java not JS??
Thanks
Clive
derek - 31 Oct 2007 17:31 GMT
> Hi,
> I have a combobox with values 1, 0, -1.
[quoted text clipped - 8 lines]
> Thanks
> Clive
if you want a specific option to be selected, just print this html out.
<option value="whatever" selected> </option>
Note the "selected" keyword.
It will make the option show as selected.
You will want add an if check in your code to determine where to output the "selected" text though.
Lew - 31 Oct 2007 23:52 GMT
> if you want a specific option to be selected, just print this html out.
>
[quoted text clipped - 5 lines]
>
> You will want add an if check in your code to determine where to output the "selected" text though.
For XHTML the attribute is
selected="selected"
You can set a String on the server side and make it a request attribute for
the forward to the JSP, for example,
<option value="whatever" ${whateverSelected} > </option>
where the logic set the variable whateverSelected to either
"selected=\"selected\"" or "".

Signature
Lew