W3C home > Mailing lists > Public > www-validator@w3.org > January 2006

Re: Error Message Feedback

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Tue, 3 Jan 2006 09:26:26 +0200 (EET)
To: Corey Salzano <corey@fridaynet.com>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.63.0601030919470.29261@korppi.cs.tut.fi>

On Mon, 2 Jan 2006, Corey Salzano wrote:

> I have a page that uses a group of radio buttons. I specified both 
> name="something" and id="something" on all 5 of the radio buttons, each 
> with a different value="something" attribute.

They should have different id="something" attributes, since the id 
attribute is by definition a _unique_ identification of an element.
Why do you use the id attribute? It can be used in conjunction with
a <label> element, where a for="something" attribute associates a label 
with an element (a form field).*) For this, it is essential that the
id="something" attribute is unique.
  *) See http://www.cs.tut.fi/~jkorpela/forms/kbd.html

> The validator says the second radio button's id attribute is invalid 
> because that id has already been assigned to another element.

That's right. The id attribute is declared with an ID value, which means 
that the value must be a unique identifier. This is all that a validator 
knows about the issue.

> I feel that 
> this is incorrect because all the radio buttons should have the same 
> name/id field and different value fields.

They need to have the same name attribute and different value attributes 
for practical reasons (though a validator knows nothing about this), but 
why do you think the id attributes should be the same, against the very 
definition of this attribute?

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Tuesday, 3 January 2006 07:26:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:20 GMT