ActiveCampaign Forum

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


#1

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!