W3C home > Mailing lists > Public > www-validator@w3.org > August 2012

Re: [VE][html5] The for attribute of the label element must refer to a form control.

From: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
Date: Fri, 3 Aug 2012 16:40:44 +0100
Message-ID: <CAEhSh3dRwDb8q=+Ezb+iLYodjEVE_9YutAsjpApX5GmOsyhgKg@mail.gmail.com>
To: Peter Mitchell <anetaweta@gmail.com>
Cc: www-validator@w3.org
On Fri, Aug 3, 2012 at 4:14 AM, Peter Mitchell <anetaweta@gmail.com> wrote:
> I am trying to fix the error I encounter when validating my site.  The error
> is a 'The for attribute of the label element must refer to a form control.'
> unfortunately I do not know what this means.

It means the value of the @for attribute of the <label> element must
match the (unique) @id attribute of the form field it is labelling.

e.g.

<label for="orderby">Sort by:</label>
<select id="orderby" name="whatever">
  <option>name</option>
  <option>date</option>
</select>

http://developers.whatwg.org/forms.html#attr-label-for

http://www.w3.org/TR/WCAG-TECHS/H44

--
Benjamin Hawkes-Lewis
Received on Friday, 3 August 2012 15:41:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 3 August 2012 15:41:42 GMT