Re: On id and name attributes

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 UTC