[WEB4LIB] Form validation problem
Chris Gray
cpgray at library.uwaterloo.ca
Fri Apr 19 16:33:58 EDT 2002
The problem is the <form> tag within the <p> tag -- form is a block level
tag and p only allows inline level content.
The second problem is that <input> is an inline level element and <form>
must contain block level elements.
These problems can be solved (in your sample page) by removing the <p> (or
changing it to div) enclosing the <form> and adding a <div> around the
hidden <input>.
Strict XHTML is very fussy about this distinction between block and
inline. A key piece of information is that <div> is essentially the only
block level element that can contain block level elements.
Unfortunately the only source I know of for this information is the strict
DTD itself. Most reference and instructional material on XHTML
concentrate on transitional XHTML. I've begun work on a tutorial on
strict XHTML and CSS, but I haven't gotten very far yet.
Chris Gray
Library Systems
University of Waterloo
On Fri, 19 Apr 2002, Robert Sullivan wrote:
> I have several PicoSearch accounts on our local history site (because of its
> 1500-page limit, I do them for specific areas).
>
> Now that I'm converting to XHTML, I find the PicoSearch code doesn't validate.
> My test page is
>
> <http://www.schenectadyhistory.org/census/1835/sch1.html>
>
> and under 1.0 Strict, the validator complains
>
> element "form" not allowed here; possible cause is an inline element containing
> a block-level element
>
> and
>
> element "input" etc. etc.
>
> If I test it under 1.0 Transitional, I don't get the second error.
>
> I haven't done much with forms, so perhaps there's something obvious to one of
> you. I have already cleaned up the PicoSearch code so that it no longer uses
> uppercase attributes and unquoted values and other things from the bad old
> days, and these are the remaining errors.
>
> Thanks for any ideas.
>
> Bob Sullivan scp_sulli at sals.edu
> Schenectady County Public Library (NY) http://www.scpl.org
>
More information about the Web4lib
mailing list