Validation errors - unsure how to resolve

Hi all

I have validated my html via the W3C validation service but one page is bringing up four errors (Link to the page). I have used [URL=“http://www.jotform.com/”]www.jotform.com to create the my contact form and I know this is what is causing the errors.

The question is how do I resolve them, in fact can I resolve them without causing a problem?

The other question I suppose is do I need to resolve them, what will happen if I don’t, anyway below are the errors, as always I appreciate any help.

Validation Output: 4 Errors

  1. Warning Line 81, Column 50: character “&” is the first character of a delimiter but occurred as data

    …=“http://www.jotform.com/min/g=jotform&3.1.96” type=“text/javascript”></script…

    :email:

    This message may appear in several cases:
    * You tried to include the “<” character in your page: you should escape it as “<”
    * You used an unescaped ampersand “&”: this may be valid in some contexts, but it is recommended to use “&”, which is always safe.
    * Another possibility is that you forgot to close quotes in a previous tag.

  2. Error Line 86, Column 90: there is no attribute “name”

    rm.com/submit.php" method=“post” name=“form_10065058685” id=“10065058685” acce…

    :email:

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the “Strict” document type with a document that uses frames (e.g. you must use the “Transitional” document type to get the “target” attribute), or by using vendor proprietary extensions such as “marginheight” (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

  3. Error Line 86, Column 113: value of attribute “id” invalid: “1” cannot start a name

    … method=“post” name=“form_10065058685” id=“10065058685” accept-charset=“utf-8”>

    :email:

    It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.

  4. Error Line 87, Column 61: document type does not allow element “input” here; missing one of “p”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”, “div”, “pre”, “address”, “fieldset”, “ins”, “del” start-tag

    &lt;input type="hidden" name="formID" value="10065058685" /&gt;
    

    :email:

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

  5. Error Line 123, Column 81: document type does not allow element “input” here; missing one of “p”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”, “div”, “pre”, “address”, “fieldset”, “ins”, “del” start-tag

    … <input type=“hidden” id=“simple_spc” name=“simple_spc” value=“10065058685” />

    :email:

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

Fix this by changing the & with & - this shouldn’t cause problems

  1. Error Line 86, Column 90: there is no attribute “name”

    …rm.com/submit.php" method=“post” name=“form_10065058685” id=“10065058685” acce…

Remove the ‘name’ attribute - as it’s not valid I can’t see removing this causing problems either, see the FAQ item on valid flash.

  1. Error Line 86, Column 113: value of attribute “id” invalid: “1” cannot start a name

    … method=“post” name=“form_10065058685” id=“10065058685” accept-charset=“utf-8”>

You can’t have an id attribute that begins with a number - you’re gonna have to remove or change it. This may break any javascript/css attached to it

  1. Error Line 87, Column 61: document type does not allow element “input” here; missing one of “p”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”, “div”, “pre”, “address”, “fieldset”, “ins”, “del” start-tag

    &lt;input type="hidden" name="formID" value="10065058685" /&gt;
    

(This also refers to error 5)
Some elements can only go into some places - if you can paste the bit of code that this refers to I can take a closer look for you

Hope that helps :slight_smile:

Thanks ever so much for taking the time to look at it, here is a link to the page in question Contact Page (I should have posted that to start with). I’ll start going through your changes now.

Regarding the 3rd one and potentially breaking the javascript/css, as it isn’t my code I don’t know what it is doing or how to fix it. I suppose I could have a look around the contact form site I have used to see if there is any help about the problem. What will happen if I left it other than it not validating?

By leaving the token starting with a number, I suppose you may run the risk of some user agent (browser etc) somewhere getting confused. Since starting with a number is not allowed, you’ll get whatever the browser vendor built in as error handling to deal with that when it is the case.

If that id is only used for CSS, it’s easy to change. If it’s just there, remove it. You can look at any javascript that page links to and just do a search for that ID. I’m pretty sure an ID on a form is never seen by the server script who deals with the sent input, so that should be ok.

Usually if I need a number for an id I try to think of a good letter to start it with and go from there.

Hi stomme thanks for that, I have changed it so we will see how it goes. Have you any idea how I could fix 4 and 5?

Have you any idea how I could fix 4 and 5?

Yes.
Inputs are inlines. You have an input as the direct child of the form. Forms may not have inlines as direct children. Your other inputs are safely inside block elements. Move the hidden input in one of them, or give it its own block parent.

Fieldsets usually solve this, but the divs can keep you legal.

When the validator says something like “this type of element not allowed here” and starts listing a bunch of block elements, you know you have an inline where it’s not allowed, or your wrapping a block element inside an inline.

Body, Form and Blockquote are 3 tags known for requiring block elements as their direct children. HTML4 requires that fieldsets (who are blocks) must be followed by a legend. XHTML does not require legends after fieldsets (but still recommended). HTML5 has removed the block-child requirement for forms entirely, possibly the other two as well (I’d have to go look).