SOLVED

Re: Check lead email domain on form if lead is known before executing custom HTML

Go to solution
Anonymous
Not applicable

Check lead email domain on form if lead is known before executing custom HTML

Greetings,

I am creating a 2 step verification, step one check if the lead is known, step 2 If the lead is known then check if their email address is from an accepted domain eg only leads from the domain marketo.com are allowed to proceed.

I started by creating a verification landing page, I created a form and hid the submit button, created a rich text field and set an error message (for unknown and non accepted domain leads). Then in the form settings I selected 'If lead is known' option and in the custom HTML, put a page redirect to the landing page known leads are able to access via a redirect script

<script>

window.location.href = "http://www.mydomain.com/welcome.html";

</script>

My question how do I also check if the known lead is from the accepted domain marketo.com only (via checking the lead's email address) before redirecting them to the welcome page? (my ideal solution)

Second option would be when the form recognises the lead as a 'known lead' it will execute the custom HTML, load the welcome page if your domain is accepted,otherwise load another page say "http://www.mydomain.com/notwelcome.html"​ instead.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Check lead email domain on form if lead is known before executing custom HTML

Typo, check your console...

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: Check lead email domain on form if lead is known before executing custom HTML

To check the known lead's domain in this scenario -- assuming this is a Marketo LP with PreFill enabled -- check the (global) JS variable

     mktoPreFillFields.Email

Anonymous
Not applicable

Re: Check lead email domain on form if lead is known before executing custom HTML

Would the check be performed in the custom HTML in the form before the redirect?

SanfordWhiteman
Level 10 - Community Moderator

Re: Check lead email domain on form if lead is known before executing custom HTML

Yep.

Anonymous
Not applicable

Re: Check lead email domain on form if lead is known before executing custom HTML

Will Add a hidden email field with Form Pre-Fill enabled and attempt to code the logic in the custom HTML, Thanks Sandy....

Anonymous
Not applicable

Re: Check lead email domain on form if lead is known before executing custom HTML

So I created a hidden email field, Pre-Fill enabled, and used this in the custom HTML For known leads used this

<script>

var allowedEmail = "@marketo.";
if (mktoPrefilLFields.Email.indexOf(allowedEmail) != -1) {
  window
.location.replace("http://www.example.com/Valid_Email.html");
}
else {
  window
.location.replace("http://www.example.com/Invalid_Email.html");
}

</script>

But its not working,  any idea's?

SanfordWhiteman
Level 10 - Community Moderator

Re: Check lead email domain on form if lead is known before executing custom HTML

Typo, check your console...

Anonymous
Not applicable

Re: Check lead email domain on form if lead is known before executing custom HTML

duuh, lol Thanks again!