HTML <input> formaction属性

❮HTML<input>タグ

アクションが異なる2つの送信ボタンがあるHTMLフォーム:

<form action="/action_page.php">
  <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>
  <input type="submit" value="Submit">
  <input type="submit" formaction="/action_page2.php" value="Submit to another page">
</form>

定義と使用法

このformaction属性は、フォームの送信時に入力コントロールを処理するファイルのURLを指定します。

この属性は、要素formactionの属性をオーバーライドします。action <form>

注:formaction属性はおよびで使用さ type="submit"ますtype="image"


ブラウザのサポート

表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。

Attribute
formaction Yes 10.0 Yes 5.1 10.6

構文

<input formaction="URL">

属性値

Value Description
URL Specifies the URL of the file that will process the input control when the form is submitted.

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<input>タグ