W3C home > Mailing lists > Public > www-validator@w3.org > February 2005

Re: NAME attribute of INPUT element should be required?

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 24 Feb 2005 09:36:38 +0200 (EET)
To: Jonatan Lander <jonatan@wineasy.se>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0502240913060.1769@korppi.cs.tut.fi>

On Thu, 24 Feb 2005, Jonatan Lander wrote:

> Is the requirement real

The statement "attribute name required for all but submit and reset"
appears in a DTD comment only. Such comments are non-normative unless
declared normative, so formally speaking, it is not a normative
requirement. (Note that the prose of the specification does not
express the requirement at the place it should, in the description
of the NAME attribute. Note that the prose - but not DTD comments -
presents a requirement of similar kind, for the VALUE attribute:
"It is optional except when the type attribute has the value "radio" or
"checkbox"." This is apparently negative way of saying that VALUE is
required for those two types.)

However it was probably _meant_ to be normative, but the
HTML specifications (except HTML 2.0, mostly) are generally not written in
a style that should be used in normative documents.

<joke class="irony">You might ask html-editor to clarify the status of the
statement in the Errata to the HTML 4.01 Specification.</joke>

Anyway, the requirement is not part of the formal syntax rules
expressed by the DTD. Whatever we think about DTD comments, they are
surely insignificant to the question of validity.

Moreover, it would not even be _possible_ to present such a requirement in
a DTD. There is no way in SGML to say that an attribute is required if
another attribute has a certain value. You can declare an attribute as
required, but then it's unconditionally required.

Actually, it might be a good idea to use a modified DTD that makes NAME
required for INPUT. This would help you to avoid omitting it by mistake.
It would make NAME required for submit and reset buttons too, of course.
In reset buttons that would be immaterial (and reset buttons are almost
always harmful anyway). In submit buttons it would imply that the
name=value pair would be included into the form data, if you have also
included a VALUE attribute (as you normally should, to avoid defaulting
the button text to something unknown). The form handler need not handle
that data, of course, but if you are using a form handler that is outside
your control, there _is_ a possibility that the inclusion of the
name=value pair has some undesired effect.

> and the
> fact that the validator doesn't catch this a limitation of the validator

No, not at all - the validator does just what it has to do: ignores
anything in DTD comments.

> (and/or of the DTD representation of the specification),

The DTD describes only part of the syntax anyway. Assuming that the
requirement is meant to be real, this is an example of this fact,
and an example of a case where the DTD _could not_ express all of the
syntax requirements.

> or is the
> requirement in fact not a requirement in the normative sense, since it
> isn't expressed in the DTD?

Whether it is a requirement or not is a bit debatable, as explained above.
But it could be a normative requirement even though it isn't in the
declarations in the DTD and could not be there. There's a lot in the HTML
4.01 specification that is normative despite not being in the DTD,

> Is the document valid or not?

It is valid.

Notes on what validation is:
http://www.cs.tut.fi/~jkorpela/html/validation.html

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Thursday, 24 February 2005 07:37:11 GMT

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