Page 1 of 1

Input Widgets for Read Only

Posted: Fri Feb 21, 2014 12:42 pm
by DaveLClarkI
I see for the text box that I can set the readonly attribute as needed to prevent input. But, I don't see the same thing for a select box. In that case, is my only choice the disabled attribute? Otherwise, in terms of a select box, I guess I'm about to find out what the styling choices are for the UL vs. PR display attributes which I previously used on the green screen...

Re: Input Widgets for Read Only

Posted: Fri Feb 21, 2014 12:52 pm
by David
Correct -- a select box has no 'read only' property, only 'disabled', and that is the only way prevent the user from modifying it.

The 'disabled' property is more consistently available, I think the browser handles this on all types of input controls. And on our widgets that are not simply basic HTML elements, we also use the 'disabled' property, as opposed to read only. The only drawback about 'disabled' is that the browser goes and applies its own styling to certain types of controls, which you then have to adjust/revert through CSS.