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;