HTML: The Markup Language

formuser-submittable form # T

The form element represents a user-submittable form.

Permitted content #

Permitted attributes #

Descriptions for attributes specific to this element #

action = URI
The submission action for the form.
method = "get" or "post" or "put" or "delete"
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.
accept-charset = character-encoding name list
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.
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 #

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

  readonly attribute HTMLFormControlsCollection elements;
  readonly attribute long length;
  caller getter any item(in unsigned long index);
  caller getter any namedItem(in DOMString name);

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

  void dispatchFormInput();
  void dispatchFormChange();

Typical default display properties #

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