The following form SHOULD validate, it is genuine and error free HTML code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head><TITLE>Form test</TITLE></head>
<BODY ONLOAD="document.theform.Comments.focus();">
<FORM ACTION="http://yucca.hut.fi/cgi-bin/sendback.pl" NAME="theform" METHOD="POST">
<P>
Enter data:
<INPUT TYPE="TEXT" SIZE="40" NAME="Comments">
<BR>
<INPUT TYPE="SUBMIT" VALUE="Send">
</FORM>
</BODY>
</html>
Notes:
The following comes from
JavaScript and HTML: possibilities and caveats
written by Jukka Korpela.
'To him shall go the credit' !!!
"The example above uses a NAME attribute in the FORM tag.
Such an attribute is probably recognized
by all browsers which are able to support JavaScript, but it is
not formally valid according to the HTML 4.0 specification,
probably due to an oversight. The practical implication is that
you will have problems in validation.
If you use the
WDG Validator (a very good idea), you can
use a customized DTD.
In this case it suffices to use
a DTD with the simple extension which
allows NAME for FORM; see
our
example modified to refer to that DTD -it
validates."
BTW: The WDG Validator mentioned above is the link behind all the valid HMTL4 banners on my site.
If you've checked and re-checked all your code and you are still stuck with the single "No attribute NAME"
error, simply change the DTD linked as part of the DOCTYPE statement and your form will validate.
<!DOCTYPE HTML SYSTEM "http://www.hut.fi/u/jkorpela/forms/HTML4ext.dtd">
<html>
<head><TITLE>Form test</TITLE></head>
<BODY ONLOAD="document.theform.Comments.focus();">
<FORM ACTION="http://yucca.hut.fi/cgi-bin/sendback.pl" NAME="theform"
METHOD="POST">
<P>
Enter data:
<INPUT TYPE="TEXT" SIZE="40" NAME="Comments">
<BR>
<INPUT TYPE="SUBMIT" VALUE="Send">
</FORM>
</BODY>
</html>
I've since uploaded the DTD file to provide my own extension to save any hassle should this useful site move.
<!DOCTYPE HTML SYSTEM "http://www.codehelp.co.uk/HTML4ext.dtd">
You can download the file, either from the link in the quote above or from
here.
Some validators will only accept DTD files from recognised locations
so use the full reference as given in the example and
link it into your relevant forms by replacing the doctype statement
that should always be line 1.