Disabled and Read-Only Fields

Many of the XHTML 1.0 form elements accept attributes that render the fields they produce as disabled—meaning the field is grayed out—or as read only, which means that the text that initially appears in the field cannot be changed. The disabled attribute takes care of disabling a field and can be used with the following elements:

  • <input />

  • <label>

  • <select>

  • <option>

  • <textarea>

  • <button>

You might want to disable an option in a drop-down list, for example, if you know from other information gathered from the user that the option was inappropriate to present.

Note

Disabled form fields are skipped over as a user tabs through the form. Also, any values assigned to a disabled field are not passed to the server when the form ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.