The Wayback Machine - https://web.archive.org/web/20081220022925/http://www.webreference.com:80/html/tutorial13/18.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / html / tutorials / 13 / 18

index123456789101112131415161718192021exercises1

Tutorial 13: Giving Form to Forms

Developer News
10 Patches, and More, for Firefox Users
IE8 'Super-Standards' Aim for Site Compatibility
Microsoft Set to Fix IE Zero Day Flaw

Disabled controls

Disabled control attribute

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>

Do you want to receive periodic e-mails about our products?

Read-only controls

Read-only control attribute

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.

<FORM ACTION="/cgi-bin/html/formdump.cgi" METHOD="GET" 
      ENCTYPE="application/x-www-form-urlencoded">
<P>Please enter any comments you feel are relevant below.
<P><TEXTAREA NAME="comments" ROWS="5" COLS="50" READONLY>
I just love your products!</TEXTAREA>
<INPUT TYPE="submit">
</FORM>

Please enter any comments you feel are relevant below.

index123456789101112131415161718192021exercises1

Produced by Stephanos Piperoglou

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Web 2.0 Tools · Installing the ASP.NET Engine, Editor, and Database System · Popular JavaScript Framework Libraries: qooxdoo and SproutCore
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Micron NAND Hits One Million Write Cycles · Pick the Winners: Excellence in Technology Awards · Branded Gifts Give E-Commerce Marketing Personal Touch

URL: http://www.webreference.com/html/tutorial13/18.html

Created: May 28, 1998
Revised: February 25, 1999

Morty Proxy This is a proxified and sanitized view of the page, visit original site.