dangermaus Posted February 4, 2021 Posted February 4, 2021 I want to exclude certain email domains (gmail, etc.) on a submission form but I am not sure how to do this. Would this be something I can do in the html itself?
dangermaus Posted February 5, 2021 Author Posted February 5, 2021 If I add the following javascript to my html form code will this work? <script> 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), }; }, }, ]; </script>
dangermaus Posted February 5, 2021 Author Posted February 5, 2021 I have tried this and it didn't work. I am unsure of where I need to place this code. Any help would be appreciated.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.