Imput Form Attribute HTML
Imput Form Attribute HTML
❮ PreviousNext ❯
The value of this attribute must be equal to the id attribute of the <form>
element it belongs to.
Example
An input field located outside of the HTML form (but still a part of the form):
Note: This attribute overrides the action attribute of the <form> element.
The formaction attribute works with the following input types: submit and
image.
Example
An HTML form with two submit buttons, with different actions:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formaction="/action_page2.php" value="Submit
as Admin">
</form>
Try it Yourself »
Note: This attribute overrides the enctype attribute of the <form> element.
The formenctype attribute works with the following input types: submit and
image.
Example
A form with two submit buttons. The first sends the form-data with default
encoding, the second sends the form-data encoded as "multipart/form-data":
Note: This attribute overrides the method attribute of the <form> element.
The formmethod attribute works with the following input types: submit and
image.
Example
A form with two submit buttons. The first sends the form-data with
method="get". The second sends the form-data with method="post":
Note: This attribute overrides the target attribute of the <form> element.
The formtarget attribute works with the following input types: submit and
image.
Example
A form with two submit buttons, with different target windows:
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formtarget="_blank" value="Submit to a new
window/tab">
</form>
Try it Yourself »
Note: This attribute overrides the novalidate attribute of the <form> element.
The formnovalidate attribute works with the following input types: submit.
Example
A form with two submit buttons (with and without validation):
<form action="/action_page.php">
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit" value="Submit">
<input type="submit" formnovalidate="formnovalidate"
value="Submit without validation">
</form>
Try it Yourself »
When present, novalidate specifies that all of the form-data should not be
validated when submitted.
Example
Specify that no form-data should be validated on submit:
Exercise?
What is not a legal form attribute for the INPUT element?
formaction
formtype
formtarget
Submit Answer »
For a complete list of all available HTML tags, visit our HTML Tag Reference.