A labelled form with the default action
<form action method="get" enctype autocomplete novalidate>A form owns labelled controls. A missing action means the current document, not a hidden server.
| Attribute | Description |
|---|---|
action | URL of the form processor. Missing or empty means the current document URL. Do not point practice forms at a third-party endpoint. |
method | get (default) appends the query to the action URL. post puts the payload in the request body. Neither one encrypts the data. |
enctype | Encoding for POST (and a few other cases). The default is application/x-www-form-urlencoded. Use multipart/form-data when the form contains a file input. |
autocomplete | on (default) or off, as a default for controls in the form. |
novalidate | Boolean. If present, the form skips constraint validation on submit. |
name | A name for the form in the document's forms collection. It is not a submitted field. |
target | Browsing context for the submission response, analogous to a target on a link. |
- This form has no action attribute and no https:// destination. It is a markup example, not a live signup or payment form.
<form>
<p>
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
</p>
<p>
<label for="title">Project title</label>
<input id="title" name="title" type="text">
</p>
<button type="submit">Check email</button>
</form>What this markup means
Each control has a name so it can be a successful field. Labels are associated with for and id. required is a client constraint only. There is no remote action, so this example does not submit data to a third party.
Related: Tag catalog: <form>, <input>, <button>, <label>, <select>, <textarea>, <dialog>, HTML tutorial: Label a form