The form attribute on a <fieldset> tag specifies the form the fieldset is associated with.
The controls inside the fieldset will be submitted with that form.
The attribute value is the id of the form.
A <fieldset> element with a form attribute. The second fieldset and its input elements are associated with the form above it.
<form action="/tutorial/action.html" method="get" id="main-form">
<fieldset>
<legend>Personal Information</legend>
<input type="text" name="fname" placeholder="First name"><br /><br />
<input type="text" name="lname" placeholder="Last name"><br /><br />
<input type="submit" value="Submit">
</fieldset>
</form> <br />
<fieldset form="main-form">
<legend>Contact Information</legend>
<input type="text" form="main-form" name="street" placeholder="Street"><br /><br />
<input type="text" form="main-form" name="city" placeholder="City"><br /><br />
<input type="text" form="main-form" name="country" placeholder="Country"><br /><br />
</fieldset>
The form attribute specifies the form the fieldset is associated with.
The attribute value is the id of the form.
The input fields inside the fieldset are not automatically included during form submission.
For that, each input element will need its own form attribute.
<fieldset form="form-id">
Value | Description |
---|---|
form-id | The id value of the form. |
Here is when form support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <fieldset>