Forum Moderators: mack

Message Too Old, No Replies

HTML validation

Please help!

         

iaaa

7:19 pm on Apr 22, 2006 (gmt 0)

10+ Year Member



Hi,

The W3C validator complains about the following code:

------------------
<div class="rnav">
<pre>Site Search</pre>

<form method="get" action="http://search.example.com/search/">
<input size="15" name="sp-q">
<input type="submit" value="Search">
<input type="hidden" name="sp-a" value="#*$!xxxxx">
<input type="hidden" name="sp-p" value="all">
<input type="hidden" name="sp-f" value="UTF-8">
</form>

</div>
------------------

In particular the error message seems to indicate that the use of <input> is incorrect. Can you spot what is wrong with that? The error message is:

"document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag."

I am sure I closed all the tags properly. The code is fine elsewhere. If I take the <form></form> part out, the page validates as HTML4.01 Strict.

Regards

iamlost

4:39 pm on Apr 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It wants a container for the inputs.

[w3.org ]


An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls.

Note that the form is a special 'section' requiring normal block-level markup to hold content and controls.

<form method="get" action="http://search.example.com/search/">
<p>
<input...
<input...
</p>
</form>

iaaa

6:01 pm on Apr 23, 2006 (gmt 0)

10+ Year Member



Thank for that. I used <p> to enclose the input tags within the form and W3C validates it as 4.01 Strict now. I d take the opportunity to note this as a minor bug in HTML-Kit which I used for the development. The HTML-Kit build-in validator still reports it as Transitional! Thats a bit of a pain - I will have to validate every single page as I upload it using W3C, otherwise I might have missed something else which would be a 'legitimate' Transitional feature.

Cheers