The formaction attribute on a submit <input> tag specifies the form-handler the form-data will be sent to.
This attribute requires that the <input> is of type submit.
An <input> button with a formaction attribute. This attribute overrides the action specified on the <form> -- in this case, with JavaScript.
<form action="/tutorial/action.html">
<input type="text" name="email" placeholder="Enter your email">
<input type="submit" value="Submit 1"/>
<input type="submit" value="Submit 2"
formaction="javascript:alert('Submit 2 formaction')" />
</form>
Tip: The formaction can also be JavaScript as seen in the above example.
The formaction attribute overrides the form's action value, if present.
This attribute specifies the URL where the form data will be sent to.
The formaction attribute requires that the input element is a of type submit
or image
.
<input type="submit | image" formaction="URL">
Value | Description |
---|---|
URL | A page or resource to which form data will be sent. |
Here is when formaction support started for each browser:
Chrome
|
1.0 | Dec 2008 |
Firefox
|
1.0 | Nov 2004 |
IE/Edge
|
10.0 | Sep 2012 |
Opera
|
10.6 | Oct 2010 |
Safari
|
5.1 | Oct 2011 |