The FORM element is used to delimit the range of data fields for
a form. This element also serves to contain information on HOW to
process the information collected in the form. There can be more than
one form in a HTML document but the FORM element can not be nested. An
explanation of HOW to process the submitted data is beyond the scope
of these documents - please refer to the Forms
Overview page for sites that deal with this subject in greater detail.
Standards
Details: Introduced in HTML 4.01. Now in all HTML 4.01/XHTML DTDs
Required? No
Description:
This attribute specifies the MIME types that the form processing server
and script should correctly handle. A browser may use this information
to filter out non-conforming files when prompting a user to select
files to upload.
Values:CDATA.
[Comma-separated list of MIME types.]
Description:
This specifies a list of acceptable language character sets for the
form data. No mention is made what should happen if data is submitted
that is NOT from any of these sets.
Values:CDATA.
[A space and/or comma separated list of language character set encodings.]
Description:
This specifies the action URL that will process the form contents.
If this attribute is absent it defaults to the BASE URL of the
current document.
Values:CDATA.
[Either an absolute or relative URL. All URLs should be URL encoded where required.]
Description:
This attribute sets the status of the form/form field 'Autocomplete' feature
in Internet Explorer 5.0. A value of 'On' indicates Autocomplete is enabled,
and 'Off' disables.
Description:
This attribute specifies the MIME media type used to encode the
name/value pairs for transport to the form processing mechanism, in
case the protocol itself does not impose a format.
Values: application/x-www-form-urlencoded
[DEFAULT] multipart/form-data
[MIME type used when an INPUT TYPE=FILE field is present]
Description:
This optional attribute specifies a method or protocol for accessing
the ACTION URL. A method of GET will
gather all form name/value pair information into a query URL that
looks like: URL?name=value&name=value&name=value
where URL is the URL specified by the ACTION attribute, or
the current document URL if no ACTION attribute was specified.
In the POST method, the contents of
the form are sent in the body of the HTTP request.
Values:GET
[DEFAULT] | POST
Name
[2|3|3.2|4]
[X1|X1.1]
[IE3B1|M|N2|O3]
Standards Details:
Introduced in HTML 4.01. Now in all HTML 4.01/XHTML 1.0 DTDs. Dropped in XHTML 1.1 in favor of ID attribute.
Required? No
Description:
This attribute is used to give a unique label to this form group
so that it can be referenced and manipulated with scripting code.
Description:
This is an SGML Document Access
(SDA) attribute. SDA attributes are designed to transform HTML (and
other SGML-based documents) to the ICADD
DTD - which is used in creating accessible documents for users with
visual disabilities (rendering in Braille, large print, speech
synthesis, etc.) The attribute value specifies content to be added
BEFORE the original element content (in this case the string
"<Para>Form:</Para>") when the SDA document is rendered.
Description:
This is an SGML Document Access
(SDA) attribute. SDA attributes are designed to transform HTML (and
other SGML-based documents) to the ICADD
DTD - which is used in creating accessible documents for users with
visual disabilities (rendering in Braille, large print, speech
synthesis, etc.) The attribute value specifies content to be added
AFTER the original element content (in this case the string
"<Para>Form End.</Para>") when the SDA document is rendered.
Value:
"<Para>Form End.</Para>"
Target
[2|3|3.2|4]
[X1|X1.1]
[IE3A1|M|N2|O2.1]
Standards Details:
In Transitional and Frameset HTML 4.x/XHTML 1.0 DTDs only. Dropped in XHTML 1.1.
Required? No
Description:
This attribute specifies the named frame for the browser to display
the form results after the user submits information to a
processing script.
DTD Note: The ACTION attribute has not been required
historically in older HTML DTDs (although it is now in HTML 4.0), but now
that form fields can be used outside of the FORM context, usage of FORM
suggests that some independent action will be taken with submitted information.
DTD Note: Support for the ACCEPT and NAME attributes
was added to HTML 4.01 and did not exist in the original HTML 4.0 DTDs.
HTML 4.x+ recommends that authors use the ID attribute instead of NAME
wherever possible, and indeed NAME has since been dropped from XHTML beginning
in XHTML 1.1.
When using the GET method, form contents must be URL
encoded, which can often require additional effort on the client
and server ends of things. Only the POST method can safely use the
entire Unicode character set.
Browser Peculiarities
[Tests: 1,
2]
There is some odd behavior with forms and the LAYER/ILAYER elements.
If a LAYER/ILAYER element is nested inside a FORM element,
and any widgets for the form (buttons, text fields, etc) are contained
within the layer, they will not appear/be rendered. If a widget/field is
to show up, the containing FORM element must lie within the
same LAYER/ILAYER element as its widgets/fields.