Forum Replies Created

Viewing 1 replies (of 1 total)
  • I too was frustrated by this lack of form validation. What an oversight IMO. Anyway, this is what I did. Ideally, place this JQuery code in your HTML <head> tags, but anywhere at all in the page will do. A lot of my code like this ends up in a footer <div>.


    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery('input[name="submit"]').bind('click', function() {
    var nameLength = jQuery('input[name="sml_name"]').val().length;
    if (nameLength < 3) {
    alert ("Please enter at least 3 letters for name");
    return false;
    }
    var pattern=/(^[a-zA-Z_.+-]+)@([a-zA-Z_-]+).([a-zA-Z]{2,4}$)/i;
    var email = jQuery('input[name="sml_email"]').val();
    if (pattern.test(email))
    return true;
    else {
    alert ("Please enter a valid email address");
    return false;
    }
    });
    });
    </script>

    – Jeff Weiss

Viewing 1 replies (of 1 total)