The formaction Attribute

The formaction Attribute

  • Specifies the URL of a file that will process the input control when the form is submitted.
  • The formaction attribute overrides the action attribute of the <form> element.
  • Is used with type="submit" and type="image".

Demonstration code

//an HTML form with two submit buttons, with different actions

<form action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit"><br>
  <input type="submit" formaction="/action_page2.php"
  value="Submit as admin">
</form>

The formaction Attribute — Structure map

Clickable & Draggable!

The formaction Attribute — Related pages: