Skip to content
Related Articles

Related Articles

HTML | formaction Attribute

Improve Article
Save Article
  • Last Updated : 30 May, 2022
Improve Article
Save Article

The HTML  formaction Attribute is used to specify where to send the data of the form. After submission of the form the formaction attribute called. The form data is to be sent to the server after submission of the form. It overrides the feature of the action attribute of a <form> element.
Syntax: 

< element formaction="URL">

Applicable: 

Attribute Values: It contains single value URL which is used to specify the URL of the document where the data to be sent after submission of the form. 
The possible value of the URL is:

  • absolute URL: It points to the full address of a page. For example: “www.geeksforgeeks.org/data-structure”
  • relative URL: It is used to point to a file within a webpage. For Example: gfg.php

Example: 
 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML formAction Attribute
    </title>
</head>
 
<body style="text-align:center;">
    <h1>
        GeeksForGeeks
    </h1>
 
    <h2>
        HTML formAction Attribute
    </h2>
 
    <form action="#" method="get" target="_self">
        <input type="text"
               id="Geeks"
               name="myGeeks"
               value="geeksforgeeks"
               formTarget="_blank"
               formMethod="post"
               formAction="test.php">
       
        <input type="submit">
    </form>
</body>
 
</html>

Output: 
 

Supported Browsers: The browsers supported by formaction Attribute are listed below: 
 

  • Google Chrome 9 and above
  • Internet Explorer 10 and above
  • Firefox 4 and above
  • Apple Safari 5.1 and above
  • Opera 15 and above
  • Edge 12 and above

 


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!