Tutorial 13: Giving Form to Forms - HTML with Style | 20 | WebReference

Tutorial 13: Giving Form to Forms - HTML with Style | 20


Tutorial 13: Giving Form to Forms

Forming a form: Controls

A form element can contain any block element, but more importantly, it can contain form controls. Form controls are things like text boxes, radio buttons, checkboxes, drop-down lists and so on that can be used to select the values of the various fields. Each control usually creates a name/value pair that forms part of the submitted data. A control has a name, which is used as the name in the name/value pair, and might also have a default value. Some controls can be made so that the user cannot change the default value, so you can send some standard, unchanging information along with the form. Finally, you can have a control that submits the form (which may also generate a name/value pair) and a control that resets all the controls to their default values so that the user can start over again.

The INPUT element is one of several elements that specifies a form control. Most common controls are specified with the INPUT element.

The INPUT element

Can only appear inside a FORM element
This is an empty element
Empty element; Start-tag is required, end-tag is forbidden

Attributes for the INPUT element

TYPE (Control type)
A contol's type can be one of text, password, checkbox, radio, submit, reset, file, hidden, image or button. An explanation of each is given below.
NAME (Name)
The name that will be used for the name/value pair that the control creates.
VALUE (Text)
The default value for the control. The precise handling of this value depends on the type of control.
SIZE (Integer)
In the case of text and password controls, this is the number of characters that will fit into the control. In other cases, it is the default width of the control in pixels. The latter use is discouraged. Both uses can theoretically be replaced by CSS, although this is not possible with all current browsers.
Only applicable to text and password controls, this attribute sets the maximum size of the string that can be entered. By default, there is no limit. If the maximum size is larger than that specified in the SIZE attribute, the browser must use some form of scrolling to allow the user to enter more data than can be seen at one time.
CHECKED (Boolean)
Only applicable to radio and checkbox controls, this attribtue specifies that the controls should be selected by default.
Only applicable to image controls, this attribute specifies the location of the image to be used in the control.
accept (List of content types)
Applicable only to file controls. A space- or comma-separated list of MIME content types that may be sent (as files) when submitting the form. This overrides the value of the accept attribute on the form element.
Read-only control attribute
Disabled control attribute
Identifier and classification attributes
Language information attributes
Title attribute
Inline style information attribute
Text alignment attribute
Tabbing navigation attribute
Accessibility key attribute
Intrinsic event handler attributes
Attributes for specifying image maps


Produced by Stephanos Piperoglou

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

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