I just ran this simple code through the w3c validation service (http://validator.w3.org/check). Here is the code I’m running through:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"
>
<html lang="en">
<head>
<title><!-- Insert your title here --></title>
</head>
<body>
<form name="testform" action="/" method="post">
<input type="text" name="testfield">
</form>
</body>
</html>
I’m getting the following error on the input field:
Line 10, Column 40: document type does
not allow element “INPUT” here;
missing one of “P”, “H1”, “H2”, “H3”,
“H4”, “H5”, “H6”, “PRE”, “DIV”,
“ADDRESS” start-tag
I don’t see anything wrong with it. Any ideas?
The problems is with how the
FORMelement is define in the DTD:So, it can either have a
%block(except forFORM) orSCRIPTelement.And
%blockis defined as:And the rest:
Since your form does not contain any of these as a direct child, the page failed validation.