The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Nice and Simple Contact Form by CSS Tricks not validating xh

  • # January 10, 2010 at 10:22 pm

    I have been trying to validate my website using xhtml validator. It seems that the only issues I have left are in regards to a contact form developed by css tricks.

    The form

    works fine but kicks back errors in the validation as seen here

    Any ideas on how to modify it so that it passes?

    # January 11, 2010 at 10:51 am

    This reply has been reported for inappropriate content.

    I’m pretty sure the only thing that needs to be done is close the line break tag on line 57, so use <br /> instead of <br>, and also close the input tag on line 59, so it should be


    The warnings are due to having labels with the "for" attribute but not having corresponding "id" attributes on the input fields.

    # January 11, 2010 at 4:40 pm

    Thanks for the response Mark. When I removed those 2 elements, it did reduce the number of errors however their was still approx. 7-8 errors left. Your comment did help me identify what elements needed to be updated. After a bit of testing the code I was able to remove all of the xhtml errors. I have included the updated code below:

    * Please note that I have little experience with PHP so my modifications may have unforseen consequences. I did test the form after making the changes and it worked in firefox 3. Updated code below to validate in xhtml:

    document name: recaptchalib.php



    xhtml validated


    document name: index.php (or whatever page the contact form will be placed)




    xhtml validated

    form method=”post” action=”contactengine.php”>


    Hopefully this helps and did not break anything. If you notice something in my updated code that I should change please let me know.



Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed