Tutorial 13: Giving Form to Forms - HTML with Style | 11
Tutorial 13: Giving Form to Forms
- DISABLED (Boolean)
- When present, this attribute
indicates that the form control is disabled.
All controls have a DISABLED attribute that can be used to make a control disabled. A disabled control cannot be manipulated by the user. However, you can use client-side scripts to modify this control and enable it at some point. This can be useful, for instance, to enable a submit button only after the user has entered all required data. Note, however, that since a user may not have access to your script, it is a good idea to disable controls through the script itself rather than using the attribute in HTML. This way, the control will only be disabled if it can be re-enabled (because you know that the script is running). Disabled control's names and values are never submitted with the form.
<FORM ACTION="/cgi-bin/html/formdump.cgi" METHOD="GET" ENCTYPE="application/x-www-form-urlencoded"> <P>Do you want to receive periodic e-mails about our products? <INPUT TYPE="checkbox" NAME="spam" VALUE="yes" CHECKED DISABLED> <P><INPUT TYPE="Submit"> </FORM>
- READONLY (Boolean)
- When present, this attribute indicates that the form control is read-only.
Read-only controls are similar to disabled controls in that they cannot be modified by the user, but the difference is that their names and values are used when the form is submitted. You can find a number of uses for read-only controls, but again most involve scripting. Not all controls can be made read-only, but those that can't (such as submit buttons) wouldn't make much sense anyway - if you can't activate a submit button, its data is not going to be used for the form anyway.
Produced by Stephanos Piperoglou
Created: May 28, 1998
Revised: February 25, 1999