Open In App

HTML | <button> formaction Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

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

Syntax: 

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

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 URL are:

  • 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 in a webpage. For Example: gfg.php

Example: 

html




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


Output:

  

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

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

Last Updated : 20 Jul, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads