Support » Plugin: Mail Subscribe List » No input validation

  • Using php code to display form: <?php echo smlsubform(); ?>
    When name and email is empty success message is displayed. There should be an error state when input is empty or email is invalid.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Someone posted this useful bit of code that solves the problem:

    <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>

    I just stuck it in a div at the end of the page where my register form is, works a treat!

    @mdolbear is there an updated version of this? It’s still not working for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘No input validation’ is closed to new replies.