[Javascript] dropdown and readonly

Mike Dougherty mdougherty at pbp.com
Thu Oct 28 11:34:50 CDT 2004


If the intent is to prevent a user from changing the value in the select box, then:

1.  Why use an interactive select box to display static text?
2.  It's somewhat user-abusive, but you could trap onFocus and refocus another field
     (disable the ability to even select the control)

>When I need to make a SELECT 'readonly' (as you say), I do it via JS and
>then insert the value I want into a hidden INPUT with the same name.
>
>When the SELECT is not 'readonly', then the HIDDEN is DISABLED so its
>value (or lack there of) is not sent to the server.



More information about the Javascript mailing list