« In case you were on Mars... | Main | More on Forms »

XHTML form element tip

I've been working on two new sites for my company, JSW4.NET. The one I am coding myself has XHTML and CSS validation links at the bottom of the pages to prove that my code is good and pure. (What a geek!)

On one page I constructed a form for contacting me. (This is something all web site managers should think about. It gets your email addresses out of your pages. I mentioned another trick I use to accomplish this important task in "Sweet Trick" on March 12 this year.)

When I tried to validate the page with the form I got a cryptic error that said something about needing an obj or applet tag. This was confusing to me, and frankly I am still not sure what the error message meant. But I figured out what the actual error was.

Upon further examination, it turns out I had illegally included the form in an in-line context. You can't do that.

A form is a block level element that cannot be included inside of certain other block level elements, in my case a paragraph. (

)

I moved the form outside the paragraph and everything validated fine.