...

View Full Version : errors massage from w3 validate



kamkam
07-03-2007, 11:48 AM
Hi;
I write a html, and it give me the following errors massage from W3 Validate.
it make me comfuse with what it said i could not use the <br>. The following are my error massage and my code. Could you tell me how to fix it, please.

//////////////////////////////////////////////////
Error massages as following;

# Error Line 38, column 0: character data is not allowed here .

Type a Country Name for you:

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


# Error Line 39, column 3: document type does not allow element "BR" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag .

<br>

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


# Error Line 40, column 41: 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="text" name="CName" size="50">


# Error Line 41, column 35: 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" value="Submit">


# Error Line 43, column 6: 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 which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.



/////////////////////////////////////////////////////////////////

My code as following;



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title> Welcome to my page </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
html{
margin: 0;
padding: 0;
}

body { margin: 0;
padding: 0;
}
#CCNameForm
{
width: 400px;
height: 80px;
color: #eee60f;
background-color: #676fd3;
margin: 10% 30% 40% 30%;
font: normal bold 20px arial, Helvetica, sans-serif;
border: 4px solid #1418d1;
padding:2px;
}

form
{
margin: 0;
padding:0;
}
</style>
</head>
<body>
<div id="CCNameForm">
<form name="CCNameForm" action="CCName2.php" method="post">
Type a Country Name for you:
<br>
<input type="text" name="CName" size="50">
<input type="submit" value="Submit">

</form>
</div>
</body>
</html>

Jutlander
07-03-2007, 11:57 AM
This will pass validation:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title> Welcome to my page </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
html{
margin: 0;
padding: 0;
}

body { margin: 0;
padding: 0;
}
#CCNameForm
{
width: 400px;
height: 80px;
color: #eee60f;
background-color: #676fd3;
margin: 10% 30% 40% 30%;
font: normal bold 20px arial, Helvetica, sans-serif;
border: 4px solid #1418d1;
padding:2px;
}

form
{
margin: 0;
padding:0;
}
</style>
</head>
<body>

<div id="CCNameForm">
<form name="CCNameForm" action="CCName2.php" method="post">
<div>
Type a Country Name for you:<br>
<input type="text" name="CName" size="50">
<input type="submit" value="Submit">
</div>

</form>
</div>

</body>
</html>


It is because all input must be within a parent of some sort and also <br> tags (I believe it is under the strict doctypes, which this is)

ronaldb66
07-03-2007, 12:42 PM
Although a div will validate, the use of the label element (http://www.w3.org/TR/html4/interact/forms.html#h-17.9) would probably be more appropriate in this context.

kamkam
07-04-2007, 09:57 AM
Thanks Jutlander, it does work.

kamkam
07-04-2007, 09:57 AM
Hi ronaldb66;
Thanks for your advice.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum