RE: Accessible forms in XHTML

> but there IS a reason for the difference in values for the id and
> name attributes? Is there a reason why they can't be the same?

Not as far as I know in situations where you have one form.

If you have two or more forms which both contain an input with the same name
then you must have different id attributes because id attributes must be
unique within a document.

It's worth noting that the name attribute on an <input> element is quite
different to the name attribute on an <a> element - which is part of the
reason for the name attribute on <a> being deprecated in the first place (it
was deprecated back in HTML4.0 BTW).

On an <a> element name played the same purpose that the id attribute now
plays on all elements in identifying a fragment of the document. It
therefore makes sense to have the same value for the name and id attributes
so that the same fragment identifier will be matched to that element in
current browsers (using the id attribute) and older browsers than only
support name.

Since name doesn't do this on <input> elements there is no need to match the
values, but no big reason not to either, though it can be useful to have
different conventions for each).

Received on Wednesday, 17 July 2002 06:38:20 UTC