HTML input Tag formaction Attribute Tutorial

In this section, we will learn what the formaction attribute is and how to use it.

What is formaction Attribute in HTML <input> Tag?

First of all, the formaction attribute is used in <input> elements of type image and submit.

This attribute is used to set the server address (absolute or relative URL) to which the form data should be sent to.

Note: if the target form element that has the submit or image button in it already has the attribute `action`, that value will be overridden by the value of the formaction attribute then.

HTML formaction Attribute in <input> Tag Syntax:

<input type = “submit | image” formaction = “URL”>

<input> Tag formaction Attribute Values

The value of the formaction attribute is the server address (absolute or relative URL) to which the target form data should be submitted to.

Example: using formaction attribute in HTML <input> tag

See the Pen using formaction attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.

Here even though the <form> element has a URL address to send the form data to (the value of the action attribute in the form element), the value set for the formaction in the submit button will override and the form data will be sent to the `/loginn2` address for this particular example.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies