The Wayback Machine - https://web.archive.org/web/20090601075451/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
Rails 3 Gets Supersized With Merb
SpringSource, Hyperic Merge for App Management
Get Ready for Windows 7 'Release Candidate'

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.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info
Copyright 2009 WebMediaBrands Inc. All Rights Reserved.

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

webref The latest from WebReference.com Browse >
Getting Started with URL Rewriting with Apache · Kicking the Tires on Your Next CMS · User Personalization with PHP: The Final Scripts
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Write SQL Code for MySQL Using HeidiSQL 4 · Government Mobility and Why It's Not an Oxymoron · Site Building with Photoshop and Dreamweaver

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.