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.

Syntax:

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

<button formaction="http://example.com/search.php">Search</button>

Elements:

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

Example

Example with the formaction attribute:

 

›› go to examples ››