In this topic, we described about the Formaction with detailed example.
Formaction attribute used to override the action attribute of the <form> element. Formaction used to specify the URL of a file that should process when the form is submitted.
It has the same effect as the action attribute of the form element. This can only be used with a submit or image button (type="submit" or type="image").
When the form submitted, the browser checks for a formaction attribute value first. If that is not present, it proceeds to check for an action attribute value on the form.
If both are specified, it considers formaction attribute only and action attribute gets ignored.
<input type="submit" name="submit" formaction="URL/file-name">
Below example describes about how to formaction attribute used with submit element.
<html> <head> <title>Autofocus Example</title> </head> <body> <form action="form-action.php" > <label for="username">Username: </label> <input type="text" name="username" id="username"> <label for="password">Password: </label> <input type="password" name="password" id="password"> <input type="submit" value="submit" formaction="form-results.php"> </form> </body> </html>