Thuộc tính HTML <input> formaction

❮ Thẻ HTML <input>

Thí dụ

Một biểu mẫu HTML có hai nút gửi, với các hành động khác nhau:

<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>

Định nghĩa và Cách sử dụng

Thuộc formactiontính chỉ định URL của tệp sẽ xử lý kiểm soát đầu vào khi biểu mẫu được gửi.

Thuộc formactiontính ghi đè actionthuộc tính của <form>phần tử.

Lưu ý: Thuộc formactiontính được sử dụng với type="submit"type="image".


Hỗ trợ trình duyệt

Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.

Attribute
formaction Yes 10.0 Yes 5.1 10.6

Cú pháp

<input formaction="URL">

Giá trị thuộc tính

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")

❮ Thẻ HTML <input>