Re: XHTML: Invalid form tag placement

On Wed, 5 Nov 2003, Emlyn Addison wrote:

> Yet another XHTML validation snafu on the road to spiritual creaminess...

I would appreciate it if people got to the point, without trying to be
poetic.

> I'm sure that I'm not the only designer out there who has discovered
> that opening <form> and closing </form> tags have a nasty habit of
> adding vertical space.

There's nothing nasty about it. And it has nothing to do with markup
validation.

> This is especially difficult to deal with when the form has been
> carefully constructed within a table for layout purposes

You have carefully constructed yourself a problem, alright.

> My trusty workaround to this predictable HTML snafu has been to open
> <form> and </form> tags *outside* of a table's structure

You misspelled "unreliable hack". And from your description, it is obvious
that you are intentionally using invalid markup. So what are you
complaining about when you ask a validator to check and report the
validity of your markup, and it does exactly that?

> Does the XHTML validator honestly expect an entire block-level form to
> appear within a single table cell, or none at all to be considered
> valid? Or am I just missing something horribly obvious?

You are. A validator is neither honest nor dishonest. It simply does what
you ask it to do. The question is: why do you use a validator in the first
place, if you _don't_ want reports from invalid constructs?

Suggested reading on the myths and facts of validation:
http://www.cs.tut.fi/~jkorpela/html/validation.html

Regarding the extra spacing, there is a very simple solution: put
form { margin: 0; }
into your style sheet. If you are worried about the small amount of
browsers that don't support this yet, then it's not a validation problem,
and then the real problem is your page design that relies on details of
layout, instead of being flexible.

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

Received on Wednesday, 5 November 2003 16:59:59 UTC