Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2005, 03:29 AM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default W3C Validation of FORM

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 "").

#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


 
Old April 27th, 2005, 08:13 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

It wants a containing element for that <input> element.

This validates as HTML Strict:
Code:
 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/html-code-clinic-90/.

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
 
Old April 27th, 2005, 10:39 AM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Form doesn't w3c validate, html 4.01 mps2006 HTML Code Clinic 1 November 26th, 2006 03:41 AM
W3C XHTML Validation on ASP:Label control rit01 ASP.NET 2.0 Basics 6 June 26th, 2006 12:30 PM
ASP/ASPX W3C validation URL OldCoder HTML Code Clinic 4 April 8th, 2006 11:58 PM
W3C Validation help!! Mantis HTML Code Clinic 8 April 3rd, 2006 02:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.