Email validation code?

Anonymous
Not applicable

Email validation code?

Hi All,

I've found the following javascript online to use for email validation to block out personal email addresses. However, I've put it on a Marketo landing page with a form and am still able to submit the form using my gmail address. Any ideas on how to tweak the javascript or a different javascript to use? Thanks in advance!

<script type="text/javascript">
function isGoodEmail(email) {
    if(isValidEmail(email)) {
        if(/(aol|gmail|yahoo|hotmail)\.com$/.test(email)) {
           alert(' valid email, but not for this site.  No free service emails!');
           return false;
        }
        return true;
    }
    return false;
}
</script>
 
Tags (1)
1 REPLY 1
Anonymous
Not applicable

Re: Email validation code?

It does not work because the submit button has no reference to function isGoodEmail. It is just out of context.

You can either enforce that validation or use a more robust script: Reject email addresses from specific domains
http://community.marketo.com/MarketoResource?id=kA650000000GttGCAS