Though the primary method of specifying a form element’s submission URL is via its action attribute, a submit button may specify an alternate action to submit to via its formaction attribute. This is useful because often a form will contain more than one button and it is advantageous to be able to specify a different submission URL for each button.


<input type="submit" value="Search" formaction="/search.php" />

<button formaction="">Search</button>


NOTE: The specified formaction URL may be either an absolute or relative path.


Example with the formaction attribute:


›› go to examples ››