Rule 11.1.2
Summary
This rule checks that each <label> element with a for attribute references an existing form field via its id attribute.
Business description
Criterion
Test
Description
Chaque champ de formulaire associé à une balise
<label>ayant un attributfor, vérifie-t-il ces conditions ?
- Le champ de formulaire possède un attribut
id.- La valeur de l’attribut
forest égale à la valeur de l’attributiddu champ de formulaire associé.
Level
A
Technical description
Scope
Page
Decision level
Decidable
Algorithm
Selection
Set1
All <label> elements with a for attribute:
label[for]Process
Test1
For each element in Set1, check that the value of the for attribute matches the id
attribute of an existing element in the page.
For each element returning false in Test1, raise a MessageA.
MessageA: Label for missing form field
- code: LabelForMissingFormField
- status: Failed
- parameter:
forattribute value, tag name - present in source: yes
Analysis
Passed
All <label> elements with a for attribute reference an existing element with a matching id
(Test1 returns true for all elements in Set1).
Failed
At least one <label> element with a for attribute does not reference any existing element
(Test1 returns false for at least one element in Set1).
Not Applicable
The page has no <label> element with a for attribute (Set1 is empty).