HTML <select> form Attribute

Definition and Usage

form Attribute that specifies the form to which the dropdown list belongs.

The value of this attribute must be equal to <form> element The id attribute.

Example

A dropdown list located outside the form (but still part of the form):

<form action="/action_page.php" id="carform">
  <label for="fname">Name:</label>
  <input type="text" id="fname" name="fname">
  <input type="submit">
</form>
<label for="cars">Please select a car brand:</label>
<select name="cars" id="cars" form="carform">
  <option value="audi">Audi</option>
  <option value="byd">BYD</option>
  <option value="geely">Geely</option>
  <option value="volvo">Volvo</option>
</select>

Try It Yourself

Syntax

<select form="form_id">

Attribute Value

Value Description
form_id

Specifies the form element to which the <select> element belongs.

The value of this attribute must be equal to the id attribute of the <form> element in the same document.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support