|
Subject:
|
W3C Validation of FORM
|
|
Posted By:
|
steamydave
|
Post Date:
|
4/27/2005 3:29:33 AM
|
Hi, I'm having trouble with the W3C validation of the search for I have been trying to include in my page. Test page was created as per the XHTML and CSS Web Sites.
Below is a cut-down version of a simple page/site which still doesn't go through the validation! I can't see why!
************************************************************ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Test WebSite</title> <style type="text/css"> <!-- body { font-family: verdana, sans-serif; } --> </style>
</head>
<body> <div id="mainbody"> <form action="search.asp" method="post"> <input type="submit" name="submit" value="Search"> </form> </div> </body> </html> ************************************************************* The validation results are as follows...
------------------------------------------------------------------ Line 20, column 50: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag
<input type="submit" name="submit" value="Search">
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
#9993;
Line 21, column 7: end tag for "FORM" which is not finished
</form>
Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>
Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete. ---------------------------------------------------------------------
If I get rid of the input item, then just the second error is reported, so a simple opening of and form and closing it still wont validate!
Please can someone tell me what I'm doing wrong?!
Dave
|
|
Reply By:
|
richard.york
|
Reply Date:
|
4/27/2005 8:13:13 AM
|
It wants a containing element for that <input> element.
This validates as HTML Strict:
1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
2: <html>
3: <head>
4: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5: <title>Test WebSite</title>
6: <style type="text/css">
7: <!--
8: body {
9: font-family: verdana, sans-serif;
10: }
11: -->
12: </style>
13: </head>
14: <body>
15: <div id="mainbody">
16: <form action="search.asp" method="post">
17: <div>
18: <input type="submit" name="submit" value="Search">
19: </div>
20: </form>
21: </div>
22: </body>
23: </html>
Don't know why there /must/ be a containing element between the <form> and the <input> doesn't seem like it should matter, but apparently it does.
If you change the DOCTYPE to HTML Transitional, it will validate in its original form.
BTW, this question is off-topic for this forum, please post markup questions in the HTML forum http://p2p.wrox.com/forum.asp?FORUM_ID=84.
HTH!
Regards, Rich
-- [http://www.smilingsouls.net] Mail_IMAP: A PHP/C-Client/PEAR solution for webmail Author: Beginning CSS: Cascading Style Sheets For Web Design
|
|
Reply By:
|
steamydave
|
Reply Date:
|
4/27/2005 10:39:46 AM
|
Thanks very much Rich.
Will give it a go. I have for now set the page to Transitional, and as you say, no problem there!
Sorry for being "off-topic" , newby to forum and validation! Have been validating the CSS as well.
Glad you picked it up in the wrong place as I would never have tried the inner container method.
Thanks again,
Dave
|
|