Generally speaking, what is <fieldset> useful for?

5 answers

This was chosen as the best answer

The W3 says the following: "The FIELDSET element allows authors to group thematically related controls and labels. Grouping controls makes it easier for users to understand their purpose while simultaneously facilitating tabbing navigation for visual user agents and speech navigation for speech-oriented user agents. The proper use of this element makes documents more accessible."

It's a pretty good resource for similar questions.

Answered almost 8 years ago by Niels Bom
danwellman 5600

fieldsets are also essential in .net where every page is contained within a form element. Forms can't be children of other forms but fieldsets of course can :)

Answered almost 8 years ago by danwellman

fieldset is used in form's. It groups form elements to make a complex form easier to understand.

Answered almost 8 years ago by Sven Finke

Drupal has one of my favorite uses for fieldsets: it uses javascript to turn them into collapsable groups of form fields.

Here's a jQuery collapsible fieldset plugin that does the same thing.

Answered almost 8 years ago by Justin Hileman

As Sven Finke said, the fieldset groups form elements to make forms easier to understand. They're essential for making a form accessible (e.g. for users using assistive technology such as screen-readers). Even for forms that aren't particularly complex they can be useful for breaking a form down into "sections" - for example on a contact form on a website say with fields for 'name', 'email address', 'phone number', 'question' and 'comments', you could break the form down into two fieldsets, one for the user's contact information (name, email and phone number), and another for the question and comments. Apart from making more sense to a screen-reader user, you can use CSS to style the fieldset element to visually break the form up (user's don't tend to feel quite so daunted if a form's broken into smaller 'chunks').

There's some nice examples of how you can really brighten up forms with CSS and fieldsets here on CSSPlay.

Answered almost 8 years ago by NeonBlue Bliss