Created
July 19, 2023 08:26
-
-
Save dan-donica/826c74b6ca24faaf8927226f433d11f4 to your computer and use it in GitHub Desktop.
HC || Business Email Validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Begin "Business Email Validation" || Help center --> | |
<!-- Insert in Settings->Javascript->Footer --> | |
<!-- CS:20200722-02-0 --> | |
<script> | |
var label = 'Email'; | |
var standardEmail = /^(?!.+@(gmail|google|yahoo|outlook|hotmail|msn)\..+)(.+@.+\..+)$/; | |
var errorMessage = 'field: Please enter your business email address.'; | |
document.querySelector("input[name='" + label + "']").addEventListener("input", function(e){ | |
e.target.value = e.target.value.toLowerCase(); | |
}); | |
window.__custom_form_validations = [ | |
{ | |
fieldName: label, | |
validationFn: function (input) { | |
return { | |
isValid: standardEmail.test(input.value), | |
message: window._Translate.get(errorMessage), | |
}; | |
}, | |
}, | |
]; | |
</script> | |
<!-- END code that excludes standard email domains --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://help.instapage.com/hc/en-us/articles/360036003074-Business-Email-Validation