jump

HTML 5: The Markup Language (ARIA Edition)

formuser-submittable form # T

The form element represents a user-submittable form.

Permitted contents #

Permitted attributes #

global attributes
Any attributes permitted globally.
action = non-empty URL potentially surrounded by spaces #
The submission action for the form.
method = d:string "get" or d:string "post" #
The HTTP method with which a UA is meant to associate this element for form submission.
enctype = d:string "application/x-www-form-urlencoded" or d:string "multipart/form-data" or d:string "text/plain" #
A MIME type with which a UA is meant to associate the form contents for form submission.
name = non-empty string #
The name of the form.
Any string that is not empty.
accept-charset = list of character-encoding names #
Specifies the character encodings used for form submission.
aria = #
(detailed attribute description to come)
region = #
(detailed attribute description to come)
novalidate = d:string "novalidate" or d:string "" NEW #
Specifies that the element represents a form that is not meant to be validated during form submission.
target = browsing-context name or keyword #
A browsing context or keyword that represents the target of the form.
Any string that is either of the following:
autocomplete = d:string "on" or d:string "off" NEW #
Specifies whether the element represents a form for which by default a UA is meant to store the values entered into its input elements by the user (so that the UA can pre-fill the form later).

Additional constraints and admonitions #

Tag omission #

A form element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain flow elements

DOM interface #

[OverrideBuiltins]
interface HTMLFormElement : HTMLElement {
           attribute DOMString acceptCharset;
           attribute DOMString action;
           attribute DOMString autocomplete;
           attribute DOMString enctype;
           attribute DOMString encoding;
           attribute DOMString method;
           attribute DOMString name;
           attribute boolean noValidate;
           attribute DOMString target;

  readonly attribute HTMLFormControlsCollection elements;
  readonly attribute long length;
  getter Element (unsigned long index);
  getter object (DOMString name);

  void submit();
  void reset();
  boolean checkValidity();
};

Typical default display properties #

form {
display: block;
margin-top: 0em; }