HTML Input form* Attributes

This chapter describes the different form* attributes for the HTML <input> element.

The form Attribute

The input form attribute specifies the type of<input> part of it.

The value of this feature must be equal to the id of the element

of which we are a part.


Example

An input field located outside of the HTML form (but still a part of the form):

<form action="/action_page.php" id="form1">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="Submit">
</form>

<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" form="form1">

The formaction Attribute

The input format specifies the file URL that will process the input when the form is submitted.

Note: This attribute overrides the feature action.

The layout attribute works with the following input types: submit 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>