08-05-2019 06:58 AM - edited 08-05-2019 06:59 AM
I want to prevent sponsors from entering an email addresses for the sponsored account that contains a few domains (e.g. - @example.com).
I didn't have luck using the first script detailed here:
I had more luck using the second lot of 3 x scripts. However they are written for the person being visited; not the email of the sponsored guest. I've modified the script so that it works on the email address field.
One problem remains; it does the opposite of what it is supposed to do. It is supposed to prevent users entering corporate domain email adddresses (i.e. - black-listing certain domains) but instead it only allows the domains listed in the script (white-listing).
How can the script be changed so that the domains listed in the script are prevented?
See below:
Solved! Go to Solution.
08-10-2019 08:38 AM - edited 08-10-2019 08:44 AM
Hi Scott,
Please check the script in the below community page under heading "Restrict the email address entered when creating a known account".
08-13-2019 01:07 AM
Hi Scott,
can you please try the below script.
<script> $(document).on("pageshow", function(){ setTimeout(function() { $('.emailAddress').val(""); var domains = ["domain1.com","domain2.net","domain3.com"]; function validateDomain(me){ var idx1 = me.target.value.indexOf("@"); if(idx1>-1){ var splitStr = me.target.value.split("@"); if(domains.indexOf(splitStr[1])>-1){ me.target.value=""; alert("Enter a valid email address."); return false; } } } $(function () { $('.emailAddress').blur(function (ele) { validateDomain(ele); }); }); }, 5000); }); </script>
08-05-2019 09:17 AM
08-06-2019 01:30 AM
Cheers Jason.
08-08-2019 06:00 AM
@Jason Kunst Did you have any luck chasing down a script?
08-08-2019 06:24 AM
08-08-2019 07:41 AM
Great - thanks.
08-10-2019 08:38 AM - edited 08-10-2019 08:44 AM
Hi Scott,
Please check the script in the below community page under heading "Restrict the email address entered when creating a known account".
08-12-2019 04:17 AM - edited 08-12-2019 04:18 AM
Thanks - this works although I did need to change the .personBeingVisited to .emailAddress.
One issue however; the script works based on domain; not FQDN. Therefore it blocks domain1.com and domain1.net. I only want it to block domain1.com. I'm unable to specify the FQDN; if I do the script doesn't work. Can it be modified so that the FQDN and not just the domain can be entered?
08-13-2019 01:07 AM
Hi Scott,
can you please try the below script.
<script> $(document).on("pageshow", function(){ setTimeout(function() { $('.emailAddress').val(""); var domains = ["domain1.com","domain2.net","domain3.com"]; function validateDomain(me){ var idx1 = me.target.value.indexOf("@"); if(idx1>-1){ var splitStr = me.target.value.split("@"); if(domains.indexOf(splitStr[1])>-1){ me.target.value=""; alert("Enter a valid email address."); return false; } } } $(function () { $('.emailAddress').blur(function (ele) { validateDomain(ele); }); }); }, 5000); }); </script>
08-14-2019 12:26 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide