Form validation for non-free webmail email addresses

Home Forums Quform WordPress Form validation for non-free webmail email addresses

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12428
    chrisbranum
    Participant

    I’m trying to incorporate an extra form validation function that will display an error if users try to submit form data with a free email provider domain in the ‘Email’ input field.

    I found the below code but am not sure if I can incorporate it into my form or where to add it:
    <script>

    lp.jQuery(function($) {

    // Config
    var field = 'email';
    var message = 'Please enter your business email address.';

    // Define the rule and apply it to the field
    $.validator.addMethod('notWebmail', function(value) {
    return !/\@(gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol)\./.test(value);
    }, message);

    var rule = module.lp.form.data.validationRules[field];
    if ( rule ) rule.notWebmail = true;

    });

    </script>

    #12460
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    • This reply was modified 9 years, 7 months ago by Ally.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy