Forum Moderators: open

Message Too Old, No Replies

W3C Validation

Document type does not allow element "blah" here

         

DrDoc

9:54 am on Mar 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Usually I do not disagree with W3C's validation or the DTDs. But there's one little thing that bugs the blueberries out of me.

Document type does not allow element "blah" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

This happens if I do the following:

<div>
<form>
Some text:<br />
<input><br />
</form>
</div>

However, if I change it to:

<div>
<form>
<div>
Some text:<br />
<input><br />
</div>
</form>
</div>

... then it passes a happy validator.

Can someone tell me why it's so wrong to do what I did in the first example? Or, is it just that W3C is trying to tell me that, "hey, you didn't include that section in a paragraph or equivalent block." I can understand that much... it's good style to use paragraphs etc. But it's already in a div, and that is a valid block ...

Oh well :)

tedster

11:57 am on Mar 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I remember from somewhere a long time ago that even in early versions of HTML the <form> tag needed to be an odd bird. I once read that <form> needed to be somehow SENIOR to the <body> tag in the functional hierarchy of a browser, just so that forms could offer the user interactivity that they do.

I've also noticed that, in some browsers at least, form tags are the first to "disappear" when a link is clicked - they're off the screen long before the other page elements vanish.

So when the W3C says that forms in XHTML can't include any "bare naked" text, my guess is that it falls into this realm.

I doubt that I'll ever write a browser...that's just not my thing. But in the drive for a well formed language, I have been growing a sense of trust for why these rules need to be the way they are.

DrDoc

6:39 pm on Mar 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, I know that form elements are entirely OS dependant, even though we can sometimes change the look of them.

What I mean, though, is that even though these rules are there for a reason, it sure doesn't make it any easier for us as developers. Certain things don't make sense. But, then again .. if you always follow good practise (by putting all content in paragraphs) then you won't have a problem at all ..

tedster

9:05 pm on Mar 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How many developers today take the time to write valid code? You're a memebr of an elite group, although it certainly is growing.

I pity the browsers and search engines on this issue - to keep their customers happy, they've got to cope with a rat's nest of bad code.

DrDoc

9:14 pm on Mar 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The sad thing is that it really isn't that hard to write valid code. It's not even hard to write cross-browser compatible code!

But, it takes a major change of mind, a new way of thinking. I've said it before, but I like to repeat myself:
Think content! Content first, layout next. And that is "next" as in layout after you've added the content, not before or during.