[thelist] validating forms to html 4.01 strict

Scott Schrantz scotts at rci-nv.com
Tue Nov 12 10:55:01 CST 2002


> -----Original Message-----
> From: Scarlett Julian (ED) [mailto:Julian.Scarlett at sheffield.gov.uk]
>
> Can anyone tell me why form elements have to be enclosed in a
> <p></p> to validate as html 4.01 strict? I know that it's like that
> in the html spec but why? Why can't we just have all the elements
> in the <form></form> tags? At first I thought it was probably a
> block/inline thing but I don't think it is now.

It is a block/inline thing. Straight from the DTD:

<!ELEMENT FORM - - (%block;|SCRIPT)+

The rules say that a <form> element can only directly contain elements that
are designated as BLOCK (or scripts). And earlier in the DTD, BLOCK is
defined as

<!ENTITY % block
     "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
      BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">

So, a <form> can only directly contain one of those elements. Now, as to
"why", none of us are privy to the W3's decision making when it came to
allowing elements in forms. But, dem's the rules, and we have to follow them
if we want validation.

http://www.w3.org/TR/html401/sgml/dtd.html

--
Scott Schrantz
work: www.rci-nv.com
play: www.computer-vet.com



More information about the thelist mailing list