HTML <fieldset> form eigenschap

Definitie en gebruik

form Deze eigenschap definieert het formulier waarvan het veldsblok deel uitmaakt.

De waarde van deze eigenschap moet gelijk zijn aan de id-eigenschap van het <form> element in hetzelfde document.

Voorbeeld

De <fieldset> element buiten de formulier (maar nog steeds onderdeel van het formulier):

<form action="/action_page.php" method="get" id="form1">
  <label for="favcolor">Wat is uw favoriete kleur?</label>
  <input type="text" id="favcolor" name="favcolor">
  <input type="submit">
</form>
<fieldset form="form1">
  <legend>Personal information:</legend>
  <label for="fname">Name:</label>
  <input type="text" id="fname" name="fname" form="form1"><br><br>
  <label for="lname">Surname:</label>
  <input type="text" id="lname" name="lname" form="form1">
</fieldset>

Try it yourself

Syntax

<fieldset form="form_id">

Attribute value

Value Description
form_id

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

The value of this attribute must be 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

Note:form Attributes are new attributes in HTML5.