views:

62

answers:

2

Is there a good way to make an HTML dropdown read only. Using disabled attribute of select seems to work, but the value is not posted.

<select disabled="disabled">

I have a complex page with lots of javascript and ajax. Some actions in the form cause to drop down to be read only some actions let user decide the value.

Edit: Is there a better way other than using a hidden input?

+1  A: 

If you do not want user to pick an option, how is this different from read-only input type="text"?

Georgy Bolyuba
Or present an unordered list on the page of the options that could be available.
Swoop
A: 
<select name="selectbox" disabled="disabled">
<option>option 1</option>
<option selected="selected">option 2</option>
<option>option 3</option>
</select>

Correct me if I am wrong, but if an option is selected, the value is sent

John
No it isn't sent.
Darin Dimitrov