Restricting Free Emails (Gmail, Hotmail, etc) from Submitting on Forms

I’m hoping this is the right place to get some help and insight. I’m trying to block submissions on some specific ActiveCampaign forms from non business emails. E.g. we would not accept submissions from @gmail.com, @hotmail.com, @yahoo.com, etc.

ActiveCampaign support told me I’d have to build it into the HTML of the form and then embed it on the page.

I was thinking a JS snippet could do a pre submit validation

script type=“text/javascript”>
$(document).ready(function(e){
$(‘#btnSubmit’).click(function(){
var email = $(‘#Email’).val();
var reg = /^([\w-.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!aol.com)(?!abc.com)(?!xyz.com)(?!live.com)(?!outlook.com)(?!me.com)(?!msn.com)([\w-]+.)+[\w-]{2,4})?$/;

But it’s not working very well.

Has anyone done something like this before?

Thanks!

2 Likes

Hi - I’m interested in this topic, too - does anyone have a solution for this? Thanks -

Hello, I am also trying to do this with no luck. I’ve been trying various snippets of code but not sure if I’m even putting them in the right place.

Hey there! Just wanted to add some extra sources of info regarding this type of concerns. Although our team does not offer HTLM/ codding support, we do have a certified consultants page, where you can hire a specialist to go over any detailed of tech related issues regarding your ActiveCampaign account. I will attach the directory of experts in the different areas in case you are interested. To check it out, please click HERE.