4.33 Group related form elements using the <fieldset> element
The FIELDSET and LEGEND elements should always be used together, which allow the user to create and name groups of related input fields in HTML forms.
The FIELDSET element allows grouping the related controls and labels which helps the user to understand the purpose and makes the document more accessible.
The LEGEND elements allow the authors to assign a caption to a FIELDSET. This legend improves accessibility when the FIELDSET is rendered non-visually.
Objective:
To organize large forms with many different areas of interest in a logical way without using tables
Assist the user to understand how the input fields are related to each other
To facilitate easy tab navigation for visual users agents
Easy speech navigation for speech oriented user agents
Guidelines:
Do not use the FIELDSET and LEGEND elements if all you want to do is create a graphical border around some content on a page
Only use them to logically group related form controls, always use both elements together, and keep legend texts short.
Legend chosen should be relevant to every single form field in the FIELDSET
Example:
Telephone details
Validation Technique:
Check that groups of logically related input elements are contained within a field set element
Check that any group of input elements of type =’radio’ or type =’checkbox’ with the same name attribute is contained within a < fieldset> element
Check that each < fieldset> has a < legend> element that includes the description of that group