HTML <button> formactionAttribute

HTML button 标签参考手册HTML <button> Tag

Example

A form with two submit buttons (with different actions). The first submit button submits the form data to "demo_form.html", the second submit button submits the form data to "demo_admin.html":

<form action="demo_form.html" 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="demo_admin.html">Submit</button>
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, 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 overrides the form element'sactionattribute.

This attribute is used together with type="submit".


Differences between HTML 4.01 and HTML5

The formaction attribute is a new attribute in HTML 5.


Syntax

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

Attribute Values

Value Description
URL Specifies the address to which the form data is sent.

Possible values:

  • Absolute URL - a 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 标签参考手册HTML <button> Tag Other Extensions