dangermaus Posted February 4, 2021 Share 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? Link to comment
dangermaus Posted February 5, 2021 Author Share 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> Link to comment
dangermaus Posted February 5, 2021 Author Share 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. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment