English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <button> formaction attribute

The formaction attribute specifies where the form data is sent when the form is submitted. This attribute overrides the form's action attribute. The formaction attribute is only used for buttons of type "submit".

 HTML <button> tag

Online Example

A form with two submit buttons, the first submit button submits the form data to "action_page.php", and the second submits to "action_page"2.php":

<!DOCTYPE html>
<html>
<head>
<title>HTML:<button> formaction attribute - Basic Tutorial Web oldtoolbag.com</title>
<body>
<form action="/run/action_page.php" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <button type="submit">Submit</button><br>
  <button type="submit" formaction="/run/action_page2.php">Submit to another page</button>
</form>
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10Firefox, Opera, Chrome, and Safari support the formaction attribute.

Note: Internet Explorer 9 and earlier IE versions do not support the formaction attribute.

Definition and Usage

The formaction attribute specifies where the form data will be sent when the form is submitted. This attribute will override the form's action attribute.
The formaction attribute is only used for buttons of type "submit".
This attribute is used in conjunction with type="submit".

HTML 4.01 with HTML5difference

The formaction attribute is an HTML 5 new attribute.

Syntax

        <button type="submit" formaction="URL">

Attribute value

ValueDescription
URLSpecifies the address to which the form data will be sent.

Possible values:

  • Absolute URL - Complete page URL address (e.g., href="http://www.example.com/formresult.html")

  • Relative URL address -Points to a file on the current website (e.g., href="formresult.html")

 HTML <button> tag