W3C home > Mailing lists > Public > www-html@w3.org > July 2001

Re: On id and name attributes

From: Clover Andrew <aclover@1value.com>
Date: Mon, 16 Jul 2001 15:44:54 +0200
Message-ID: <D58B0195B58937489E89124469E57CA20D507D@EX1.1value.com>
To: <www-html@w3.org>
Bjoern Hoehrmann <derhoermi@gmx.net> wrote:

>> Each form has its own namespace for control names, and each
>> applet has its own scope for parameters.

> Ok, Erratum #1.

I don't agree; by my interpretation the sentence only applies to
anchors (the heading being "anchors with the id attribute"), not
to every 'name' attribute globally.

> if the name and id attributes for those elements don't share
> the same namespace, is so no reason why one must not use both
> attributes.

Yes: for <param> and form fields, 'id' and 'name' do completely
different things, and it should be possible to give them different
values, IE's bugs notwithstanding. I don't think the HTML spec
contradicts that. 'name' sets the control name for submitting
form data (and access to the object model through DOM Level 0
forms methods), whilst 'id' makes an anchor (and allows access
through getElementById).

Aggravatingly, the 'for' attribute of 'label' is defined as an
IDREF, which means you have to give each labelled element a
unique 'id' as well as a control name. The example code in
17.1, which does this, is also really misleading - the
firstname and lastname controls will never be submitted as
without a control name they cannot be successful. By mixing
'id' and 'name' it may also confuse people into thinking they
do the same thing, like they do with anchors. I would like
to see this example changed.

-- 
Andrew Clover
Technical Consultant
1VALUE.com AG
Received on Monday, 16 July 2001 09:47:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:49 GMT