HTML <button> formaction Attribut

❮ HTML <button>-Tag

Beispiel

Ein Formular mit zwei Senden-Buttons. Die erste Submit-Schaltfläche sendet die Formulardaten an „action_page.php“ und die zweite an „action_page2.php“:

<form action="/action_page.php" method="get">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <button type="submit">Submit</button>
  <button type="submit" formaction="/action_page2.php">Submit to another page</button>
</form>

Definition und Verwendung

Das formactionAttribut gibt an, wohin die Formulardaten gesendet werden, wenn ein Formular gesendet wird. Dieses Attribut überschreibt das Attribut des Formulars action.

Das formactionAttribut wird nur für Schaltflächen mit verwendet type="submit".


Browser-Unterstützung

Die Zahlen in der Tabelle geben die erste Browserversion an, die das Attribut vollständig unterstützt.

Attribute
formaction 9.0 10.0 4.0 5.1 15.0

Syntax

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

Attributwerte

Value Description
URL Specifies where to send the form data.

Possible values:

  • An absolute URL - the full address of a page (like href="http://www.example.com/formresult.asp")
  • A relative URL - points to a file within the current site (like href="formresult.asp")

❮ HTML <button>-Tag