SOLVED

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

Go to solution
44MattWolf44
Level 3

Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

Hey Marketo Community! Question: In the webform builder, when using Advanced Thank You Page logic, is there a way to have 2 fields to both simultaneously need specific criteria in order for a specific Thank You Page to appear?
Theoretical example: Right now my webform logic dictates "If Product Interest = Product A, send them to Thank You Page A"
I want the logic to say "If Product Interest = Product A, AND Company Size > 1000, send them to Thank You Page B"

 

Is something like this doable? Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

No need to re-fetch the values, though. They’re already in the first argument.

MktoForms2.whenReady(function (form) {   
  form.onSuccess(function(submittedValues, followUpUrl) {
    if (submittedValues.ProductInterest == "Product A" && submittedValues.CompanySize > 1000 ) { 
        location.href = "https://www.example.com";
    } else {
        location.href = "https://<your default-thank you page>";
    }
    return false;
   }
 });
});

 

Also technically you should copy the aliId value from the original followUpUrl to the custom Thank You URL.

View solution in original post

4 REPLIES 4
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

You can use Mktoforms 2.0 onSuccess handler to handle such cases. You can more conditions using if else if else as well. Ideally, you'd want to add this script right before the closing body tag (</body>).

 

MktoForms2.whenReady(function (form) {   
 form.onSuccess(function(values, followUpUrl) {
    var vals = form.vals();
    if (vals.ProductInterest ==  "Product A" && vals.CompanySize > 1000  ) 
        location.href = "https://www.example.com";
    else
        location.href = "https://<your default-thank you page>";
        return false;
    });
});
SanfordWhiteman
Level 10 - Community Moderator

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

No need to re-fetch the values, though. They’re already in the first argument.

MktoForms2.whenReady(function (form) {   
  form.onSuccess(function(submittedValues, followUpUrl) {
    if (submittedValues.ProductInterest == "Product A" && submittedValues.CompanySize > 1000 ) { 
        location.href = "https://www.example.com";
    } else {
        location.href = "https://<your default-thank you page>";
    }
    return false;
   }
 });
});

 

Also technically you should copy the aliId value from the original followUpUrl to the custom Thank You URL.

44MattWolf44
Level 3

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

Got it, thanks so much for the help Sanford! Also thank you in general for pretty much being the Batman of the Marketo community, saving the day left and right

SanfordWhiteman
Level 10 - Community Moderator

Re: Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values?

You’re welcome!