treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Help w/ Live Validation Library

  • I'm using live validation on my http://mdgrech.com, I would like to use an image instead of of the valid/invalid message. Please help.

    <form action=\"index.php#contact_results\" method=\"post\">

    <label>Name:</label> <input id=\"name\" type=\"text\" name=\"name\" />
    <script type=\"text/javascript\">
    var name = new LiveValidation('name', { validMessage: \"Thanks!\", wait: 500 } );
    name.add( Validate.Length, { minimum: 2, tooShortMessage: \"Too short\" } );
    </script>
  • You'll just need to look for the ID and CLASS hooks, and then use those to create background images.

    For example, your invalid email error is in

    p#contact_results.error


    The problem is that the text inside of that error might change. I saw it once as "Invalid Email". If it has any other errors with the same hook, you'd have to edit the Javascript to be different.

    If you only have "invalid email" in this error field, this could work


    p#contact_results.error {
    background: url('folder/image.jpg') no-repeat;
    text-indent: -1000px;
    height: 60px; /* height of the image*/
    }