Jump to content

Form > Input Validator Error


mattmill30

Recommended Posts

Hi,I use a website called totalvalidator.com as i find its much more powerful than the w3 validator, and it also support Accessibility checks, etc.However, I've just run a page through and its returned an error:

77	<div id="content" class="border">78	  <form id="questionnaire" action="/employment_law.php" method="post">79 E609 This tag or content is not allowed here. One of the following was expected: <address> <blockquote> <del> <div> <dl> <fieldset> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <ins> <noscript> <ol> <p> <pre> <script> <table> <ul>			   <input name="process_questionnaire" type="hidden" value="Employment Law" />80		<div class="odd">81		  <div class="col1">82			<label for="ftstaff">83			  Number of full time staff?84			</label>85		  </div>

So I've checked the HTML standard http://www.w3.org/TR/html401/interact/forms.html#h-17.4 and I can't find anywhere that says that there has to be a block element between the form and input elements. This is an XHTML 1.1 document in-case that makes a difference.In the example however it does wrap the input tags with a paragraph element: http://www.w3.org/TR/html401/interact/forms.html#h-17.4.2Can someone confirm whether an element is needed between the form and input elements and if so which type of element?Off the subject, does the http standard require action="/employment_law.php" or is action="employment_law.php" syntactically better? Thanks,Matthew Millar

Link to comment
Share on other sites

You get the same error with HTML strict. And it's always puzzled me a little too, but I confess never enough to investigate it. I've always just stuck a div inside the form tags and forgotten about it.The W3C validator does not put up the complete list of acceptable block-level elements, as defined here: http://www.w3.org/TR/html401/sgml/dtd.html#blockYour post lists a much more complete list. Yet both omit <form>, which of course is block-level and is rendered as block-level.Puzzling

Link to comment
Share on other sites

I think, originally, they wanted a fieldset, but ended up allowing any element.

Off the subject, does the http standard require action="/employment_law.php" or is action="employment_law.php" syntactically better?
They mean different things. The / indicates the site root, so if your form was at http://eg.com/p/t/form.php, then /employment_law.php would bring you to http://eg.com/employment_law.php, while just employment_law.php will bring you to http://eg.com/p/t/employment_law.php.
Link to comment
Share on other sites

  • 2 weeks later...

If validation is not important, just ignore the issue. I don't believe this particular thing makes any difference in the way pages are rendered. Nothing I've noticed anyway. If validation is important to you, just stick your form controls in a div. Unless you specify style attributes for the div, it should have no visible effect on your form.In any case, adding a div is so easy to do, you might as well just do it. If you use a fieldset instead, and you don't like the border, you'll have to use CSS to make it go away. With a div, it's almost like adding nothing at all.I would not bother reporting it. You are certainly not the first to have been troubled by this. W3C probably gets an email about it every day.

Link to comment
Share on other sites

Thanks Synook,Where can i read up on this standard?Is it dealt with by the tcp/ip standard?
It's not in any "standard" - a DTD doesn't specify exactly what can go inside attributes, only what data type they are - the directory notations have just been adopted from UNIX.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...