<form> HTML element represents a document section containing interactive controls for submitting information.
This element includes the global attributes.
Comma-separated content types the server accepts.
Note: This attribute has been deprecated and should not be used. Instead, use the
Space-separated character encodings the server accepts. The browser uses them in the order in which they are listed. The default value means the same encoding as the page. (In previous versions of HTML, character encodings could also be delimited by commas.)
Controls whether inputted text is automatically capitalized and, if so, in what manner. See the
autocapitalizeglobal attribute page for more information.
Indicates whether input elements can by default have their values automatically completed by the browser.
autocompleteattributes on form elements override it on
<form>. Possible values:
off: The browser may not automatically complete entries. (Browsers tend to ignore this for suspected login forms; see The autocomplete attribute and login fields.)
on: The browser may automatically complete entries.
The name of the form. The value must not be the empty string, and must be unique among the
formelements in the forms collection that it is in, if any.
Controls the annotations and what kinds of links the form creates. Annotations include
noreferrer. Link types include
relvalue is a space-separated list of these enumerated values.
The following attributes control behavior during form submission.
The URL that processes the form submission. This value can be overridden by a
formactionattribute on a
<input type="submit">, or
<input type="image">element. This attribute is ignored when
If the value of the
enctypeis the MIME type of the form submission. Possible values:
application/x-www-form-urlencoded: The default value.
multipart/form-data: Use this if the form contains
text/plain: Useful for debugging purposes.
The HTTP method to submit the form with. The only allowed methods/values are (case insensitive):
POSTmethod; form data sent as the request body.
GET; form data appended to the
actionURL with a
?separator. Use this method when the form has no side effects.
dialog: When the form is inside a
<dialog>, closes the dialog and causes a
submitevent to be fired on submission, without submitting data or clearing the form.
This Boolean attribute indicates that the form shouldn't be validated when submitted. If this attribute is not set (and therefore the form is validated), it can be overridden by a
formnovalidateattribute on a
<input type="submit">, or
<input type="image">element belonging to the form.
Indicates where to display the response after submitting the form. It is a name/keyword for a browsing context (for example, tab, window, or iframe). The following keywords have special meanings:
_self(default): Load into the same browsing context as the current one.
_blank: Load into a new unnamed browsing context. This provides the same behavior as setting
rel="noopener"which does not set
_parent: Load into the parent browsing context of the current one. If no parent, behaves the same as
_top: Load into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one and has no parent). If no parent, behaves the same as
<!-- Form which will send a GET request to the current URL --> <form method="get"> <label> Name: <input name="submitted-name" autocomplete="name" /> </label> <button>Save</button> </form> <!-- Form which will send a POST request to the current URL --> <form method="post"> <label> Name: <input name="submitted-name" autocomplete="name" /> </label> <button>Save</button> </form> <!-- Form with fieldset, legend, and label --> <form method="post"> <fieldset> <legend>Do you agree to the terms?</legend> <label><input type="radio" name="radio" value="yes" /> Yes</label> <label><input type="radio" name="radio" value="no" /> No</label> </fieldset> </form>
|Content categories||Flow content, palpable content|
|Permitted content||Flow content, but not containing
|Tag omission||None, both the starting and ending tag are mandatory.|
|Permitted parents||Any element that accepts flow content|
|Implicit ARIA role||
|Permitted ARIA roles||
|HTML Standard |
BCD tables only load in the browser
- HTML forms guide
- Other elements that are used when creating forms:
- Getting a list of the elements in the form:
- ARIA: Form role
- ARIA: Search role