Re: Real time redirect on the basis of specific field

Ajay_Mamgain2
Level 3

Re: Real time redirect on the basis of specific field

Thank you for the suggestion.Sanford Whiteman‌ Do you think it can under hundreds of Email domains ? 

@Jay Jiang Can you elaborate on the solution ? Do I have to create a Json object and reference the domain from form fill to that and redirect on the basis of that. 

Jay_Jiang
Level 10

Re: Real time redirect on the basis of specific field

an array will work, e.g. ["domain1.com","domain2.com","domain3.com"], in a text token like {{my.domainsList}}

example (take this as pseudo code)

MktoForms2.loadForm("//app-###.marketo.com", "###-###-###", ###, function(form) {
var domainsList = {{my.domainsList}};
form.onSuccess(function(values, followUpUrl) {
var vals = form.vals(),
email = vals.Email,
domain = email.replace(/.*@/, "");
if(domainsList.includes(domain)){
location.href = "/alternate-thankyou-page";
return false;
}
});
});
SanfordWhiteman
Level 10 - Community Moderator

Re: Real time redirect on the basis of specific field

  • Don't forget that Array#includes isn't supported in any version of IE. You need to use indexOf, find, or a polyfill.
  • That needs to be a case-insensitive lookup so includes isn't suitable anyway..
  • The follow-up URL, assuming it's going to be a Marketo-hosted LP, needs to have the aliId reappended to maintain the usual forms functionality.
SanfordWhiteman
Level 10 - Community Moderator

Re: Real time redirect on the basis of specific field

Thank you for the suggestion.Sanford Whiteman Do you think it can under hundreds of Email domains ?

Yes, although I won't deny the UI gets unwieldy.

There's nothing wrong with using an onSuccess listener if you don't care about disclosing the list.

.

Ajay_Mamgain2
Level 3

Re: Real time redirect on the basis of specific field

I tried using the Advance URL thank you setting, however i was not able to include all domain in single if choice using (";" or "," ) separator do we have to create separate if choice for each domain  i.e. 150 choices . You are correct we don't want to disclose the domains and also majority of the users are using IE.

SanfordWhiteman
Level 10 - Community Moderator

Re: Real time redirect on the basis of specific field

I tried using the Advance URL thank you setting, however i was not able to include all domain in single if choice using (";" or "," )

The Advanced Thank You page, unfortunately, doesn't offer the same ease-of-use as the Visibility Rules page, though both are within the Form Editor module.

With VRs, you can use [Contains] and a regular expression. So not separated by ; or , but using the alternator | character as in

 @example1.com$|@example2.com$|@example3.com$

which has the same result of matching multiple domains with one rule.

But with Advanced TY you need separate [Ends With] choices.

Jay's JS approach can easily be made to work w/IE and to do the case-insensitive match. But it will always reveal the domains if someone is curious.

Ajay_Mamgain2
Level 3

Re: Real time redirect on the basis of specific field

I tried the method which you have mention and  included the alternator with ending in regular expression however it is not working for us. 

SanfordWhiteman
Level 10 - Community Moderator

Re: Real time redirect on the basis of specific field

I was mentioning regex to say it doesn't work for Advanced Thank You even though it does work in other parts of Form Editor.

Ajay_Mamgain2
Level 3

Re: Real time redirect on the basis of specific field

So how should i proceed in this case without exposing the domains and redirect the leads on the basis of domain using Advanced Thank you page ?

Ajay_Mamgain2
Level 3

Re: Real time redirect on the basis of specific field

I used this in Advance Thank you page however leads are not getting redirected.

@example1.com$|@example2.com$|@example3.com$