HTML <input> formaction-Attribute

Definition und Verwendung

formaction Attribute legt die URL fest, die beim Absenden des Formulars für die Verarbeitung der Eingabekontrollen verwendet wird.

formaction Attribute überschreiben den action-Attribute

Hinweis:formaction Attribute mit type="submit" und type="image" zusammen verwendet.

Beispiel

HTML-Formular mit zwei Submit-Buttons, die unterschiedliche action-URLs haben:

<form action="/action_page.php">
  <label for="fname">名字:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">姓氏:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="提交">
  <input type="submit" formaction="/action_page2.php" value="Submit to Another Page">
</form>

Try It Yourself

Syntax

<input formaction="URL">

Attribute Value

Value Description
URL

Specifies the URL of the file that will process the input controls when the form is submitted.

Possible Values:

  • Absolute URL - The complete address of the page (e.g., href="http://www.example.com/formresult.asp")
  • Relative URL - Points to a file within the current site (e.g., href="formresult.asp")

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support 5.1 10.6