HTML <button> form Attribute
Example
<form action="action.php" method="get" id="formId">
<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">
</form>
<button type="submit" form="formId" value="Submit">Submit</button>
Meaning
The form attribute should be set to a string that corresponds to the id of the form element that the button is associated with.
Standard Syntax
<button type="button|reset|submit" form="formId">
Advertisement
Attribute Values
| Value | Description |
|---|---|
| formId | The value of this attribute must be the id attribute of a <form> element in the same document. |