Re: Error Message Feedback

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

> 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,

Received on Tuesday, 3 January 2006 07:26:31 UTC