jump

HTML: The Markup 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 = 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 = string #
The name part of the name/value pair associated with this element for the purposes of form submission.
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;
  caller getter any (in unsigned long index);
  caller getter any (in DOMString name);

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

  void dispatchFormInput();
  void dispatchFormChange();
};

Typical default display properties #

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