Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values? | Community
Skip to main content
Level 3
Apr 17, 2023 5:15 PM UTC
Solved

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 17, 2023 7:56 PM UTC

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.

4 replies

Darshil_Shah1
Community Manager
Apr 17, 2023 6:23 PM UTC

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; }); });
Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 17, 2023 7:56 PM UTC

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.

Translate
Level 3
May 3, 2023 2:53 AM UTC

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

Translate