Webform builder, Advanced Thank You Page logic, can you have 2 simultaneously required field values? | Community
Skip to main content
New Participant
April 17, 2023
Solved

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

  • April 17, 2023
  • 1 reply
  • 1846 views

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.
Best answer by SanfordWhiteman

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.

1 reply

Darshil_Shah1
Community Manager
April 17, 2023

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
SanfordWhitemanAccepted solution
New Participant
April 17, 2023

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.

New Participant
May 3, 2023

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