Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorhebel
    • CommentTimeAug 17th 2006
     permalink
    Can someone please tell me why this doesn't validate:

    <form method="post" action="mail.php"><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
    <p class="form">E-mail: </p>
    <input name="email" type="text" size=40><br />
    <p class="form">Message: </p>
    <textarea name="message" rows="15" cols="40"></textarea><br />
    <p><input id="button" input type="submit" value="Send"></p>
    </form>

    I am a real amateur at php and couldn't make head nor tail of the W3C comments.
    • CommentAuthorPettyRider
    • CommentTimeAug 17th 2006 edited
     permalink
    Your INPUT elements need to be in a block-level element, like a DIV or a P, but a FIELDSET is recommended.

    <form method="post" action="mail.php"><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
    <fieldset><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
    <legend>These Fields</legend>
    <p class="form">E-mail: </p>
    <input name="email" type="text" size=40><br />
    <p class="form">Message: </p>
    <textarea name="message" rows="15" cols="40"></textarea><br />
    <p><input id="button" input type="submit" value="Send"></p>
    </fieldset>
    </form>

    You also might want to change those P.form elements to LABELs. An the BRs should go out the window as well.
    • CommentAuthorhebel
    • CommentTimeAug 18th 2006
     permalink
    Thanks for the advice but it still doesn't validate:

    <input name="email" type="text" size=40><br />
    an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.

    <input name="email" type="text" size=40><br />
    You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

    <input name="email" type="text" size=40><br />
    start tag was here.

    <p><input id="button" input type="submit" value="Send"></p>
    "input" is not a member of a group specified for any attribute.

    <p><input id="button" input type="submit" value="Send"></p>
    end tag for "input" omitted, but OMITTAG NO was specified.

    <p><input id="button" input type="submit" value="Send"></p>
    start tag was here.
    •  
      CommentAuthornifkin
    • CommentTimeAug 18th 2006
     permalink
    all attributes on HTML elements need to be quoted (even if their value is numeric), and all elements need to close (but can be self-closing).

    so your form fields like this:

    <input name="email" type="text" size=40>

    should really be like this:

    <input name="email" type="text" size="40" />
    • CommentAuthorvarland
    • CommentTimeAug 18th 2006
     permalink
    If you're interested, check out this article: Prettier Accessible Forms. It talks about form styling and structure, and I've found it more than helpful.
  1.  permalink
    It depends on the DOCTYPE one is using.

    A good example of a simple validated form would be something like this:
    <form action="example.html" method="post"><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
    <div id="formBox">
    <label for="email">E-Mail Address:</span></label>
    <input type="text" name="email" id="email">
    <label for="comments">Comments:</label>
    <textarea id="comments" name="comments"></textarea>
    <br />
    <input type="submit" value="Submit" name="submit" id="submit">
    </div>
    </form>
  2.  permalink
    If document type is HTML 4 it should validate.
    But it will not validate as XHTML.
    As nifkin said - it should look like this for valid XHTML document - <input name="email" type="text" size="40" />
    Why we even talking about it I fell like I back to school.

    Cheers, DS
    • CommentAuthorhebel
    • CommentTimeAug 19th 2006
     permalink
    Thanks for all the help. I finally managed to validate it.

    Sorry it felt like you were back at school, this is my first try at forms and php.
Add your comments
    Username Password
  • Format comments as (Help)