Re: DOCTYPE options on http://validator.w3.org/file-upload.html

On Tue, 12 Aug 2003, Frank Ellermann wrote:

> on the pages <URL:http://validator.w3.org/file-upload.html> and
> <URL:http://validator.w3.org/detailed.html> you offer to select
> the DOCTYPE.  The corresponding options have no values.

I presume you mean the lack of value="..." attributes in <option>
elements inside the <select id="doctype" name="doctype"> element.
Actually the first option has such an attribute, others don't.

> Checking some references I found that option values are not
> more necessary in HTML 4, but my HTML 3.2 browser doesn't know
> this.  Could you please add explicit option values ?

The value attributes were never necessary by any HTML specification.
I don't know what you mean by "HTML 3.2 browser", and I don't think there
is any browser that really complies with HTML 3.2. But if your browser
fails to default the option values, you will encounter lots of problems in
surfing. (Technically, the HTML 3.2 specification expressed the principle
rather poorly, in a DTD comment _only_:
   value  CDATA  #IMPLIED -- defaults to element content --
and, as usual, HTML 2.0 was a great improvement over its successor in
clarity, expressing this in prose.)

But what _should_ be done with those <select> elements is adding the
selected="selected" attribute into one of the <option> elements.
Otherwise browser behavior is undefined when the form is submitted without taking
any user action to select an item from the menu. Well, that's by
HTML 4.01. This is an area of great confusion in the specifications, see
http://www.cs.tut.fi/~jkorpela/forms/choices.html#app
for an overview. And the cure is very simple in a case like this where
the <select> elements each have an <option> that is _meant to be_ the
default (initially selected) option. (For some very old browsers,
<option selected> would work and <option selected="selected"> would not,
but hardly anyone uses such browsers any more, and selected="selected"
makes the original design flaw much more obvious, doesn't it? :-))

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

Received on Tuesday, 12 August 2003 01:22:04 UTC