Re: radio button validation?

On Tue, 10 May 2005, Bill Fenner wrote:

> http://www.w3.org/TR/html4/interact/forms.html#radio says that
> 'authors should ensure that in each set of radio buttons that one is
> initially "on".'

That's a good principle, which most authors are not aware of.

> Is there any way to get the validator to check for conditions like this?

Unfortunately not. The principle is not expressible in a DTD. Setting a
radio button initially "on" is done by using a 'checked' attribute, which
is declared as optional. If you declared it as required in your DTD, it
would be required in every <input> element. We cannot make the
requiredness depend on the presence of other attributes (such as 'type' in
this case) in the same element, or on other elements in the same document.
So on two accounts, it's impossible.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Wednesday, 11 May 2005 03:26:48 UTC