: Programming with HTML Forms / Form Syntax | WebReference

: Programming with HTML Forms / Form Syntax

Form Syntax

Programming with HTML Forms

Before a forms application can be described, the HTML features for defining forms need to be reviewed.

A form begins with:

name is the name of the form's data entry field, while value is its associated data.

The other method for sending data is GET. This causes the string to arrive at the server in the environment variable QUERY_STRING, which may result in the string being truncated if it exceeds the shell's command line length. For that reason, GET should be avoided.

A form can contain 8 types of data entry field:

Single line text entry fields, hidden fields, password text fields, check boxes and radio boxes are specified using the same basic HTML syntax:

field-type can be either: text, checkbox, radio, hidden, or password.

For a check box or radio button, the VALUE field specifies the value of the field when it is checked; unchecked check boxes are disregarded when name=value substrings are being posted to the application.

If several radio buttons have the same name then they act as a one-of-many selection: only one of them can be switched 'on', and so have its value paired with the name.

A hidden text field does not appear on the form, but can have a default value which will be sent to the application.

A password text field will echo *'s when a value is typed into it.

A selection list is specified using:

The option chosen will become the value associated with the selection list's name. It is also possible to include the attribute MULTIPLE after the NAME string to allow multiple selections. This maps to multiple name=value substrings, each with the same name.

A multi-line text entry field has the form:

The submit button causes the document to collect the data from the various form fields, pair it with the names of the fields, and post it to the application. The reset button resets the fields to their default values. Button syntax is:

Thirteen form examples are accessible through:

overview.html also contains more details on the syntax of form fields.

Comments are welcome

Copyright 1996 Andrew Davison and Created: Apr. 26, 1996
Revised: May 7, 1996

URL: https://webreference.com/htmlform/syntax.html