jump

HTML: The Markup Language (an HTML language reference)

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 = "get" or "post" #
The HTTP method with which a UA is meant to associate this element for form submission.
enctype = "application/x-www-form-urlencoded" or "multipart/form-data" or "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.
novalidate = "novalidate" or "" (empty string) or empty 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 = "on" or "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; }