Jump to content

Exclude specific email domains on submission form

Recommended Posts

  • Replies 2
  • Views 399
  • Created
  • Last Reply

If I add the following javascript to my html form code will this work?


  var label = 'email required';
  var standardEmail = /^(?!.+@(gmail|yahoo|hotmail|comcast|msn)\..+)(.+@.+\..+)$/; 
  var errorMessage = 'field: Please enter your business email address.';
window.__custom_form_validations = [
      fieldName: label,
      validationFn: function (input) {
        return {
          isValid: standardEmail.test(input.value),
          message: window._Translate.get(errorMessage),


Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.