Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> formaction Attribute

The formaction attribute on a submit <input> tag specifies the form-handler the form-data will be sent to.

This attribute requires that the <input> is of type submit.

Example

#

An <input> button with a formaction attribute. This attribute overrides the action specified on the <form> -- in this case, with JavaScript.

<form action="/tutorial/action.html">
  <input type="text" name="email" placeholder="Enter your email">

  <input type="submit" value="Submit 1"/>
  <input type="submit" value="Submit 2" 
         formaction="javascript:alert('Submit 2 formaction')" />
</form>

Tip: The formaction can also be JavaScript as seen in the above example.


Using formaction

The formaction attribute overrides the form's action value, if present.

This attribute specifies the URL where the form data will be sent to.

The formaction attribute requires that the input element is a of type submit or image.


Syntax

<input type="submit | image" formaction="URL">

Values

#

Value Description
URL A page or resource to which form data will be sent.

Browser support

Here is when formaction support started for each browser:

Chrome
1.0 Dec 2008
Firefox
1.0 Nov 2004
IE/Edge
10.0 Sep 2012
Opera
10.6 Oct 2010
Safari
5.1 Oct 2011

You may also like

 Back to <input>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides