SOLVED

Displaying multiples thank you pages according to multiple conditions on the form

Go to solution
Adrien_Evangeli
Level 1

Displaying multiples thank you pages according to multiple conditions on the form

Hello Marketo Com,

 

We are working on our thank you pages on MKTO but we want to have 2 conditions in order to display a different thank you page according to 2 form fields. 

 

Example : If field XXX is "123" and if field YYY is "234" Follow up page is "456"  

And etc. in order to have multiple thank you pages according to 2 conditions.

 

There is a screenshot but looks like we can't have 2 conditions together.

Adrien_Evangeli_0-1674815498173.png

 

Thank you for your help! 

 

Best

Adrien EVANGELISTA

ALLIANZ TRADE FRANCE

 

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Displaying multiples thank you pages according to multiple conditions on the form

This could be done very easily using the Marketo Forms2 JS library - 

 

 

MktoForms2.loadForm("pages.example.com", "AAA-BBB-CCC", <insert-form-id>, function(form) {
    form.onSuccess(function(values, followUpUrl) {
       var vals = form.getValues();
       if (vals.Field1 == "value1" && vals.Field2 == "value2") { //replace values & fields with the actual values
        	location.href = "https://example.com/page1"; //add thank you page1 URL
       } else if (vals.Field1 == "value3" && vals.Field2 == "value4") { //replace values & fields with the actual values.      
        	location.href = "https://example.com/page2"; //add thank you page2 URL
       }
       //add more conditional statements if required

        return false;
    });
});

 

Since this is not configured at the form-level, you'd need to add script on webpages using this form, contrary to the form-level updates which get applied to all the pages using form upon approving the LPs.

 

 

View solution in original post

1 REPLY 1
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Displaying multiples thank you pages according to multiple conditions on the form

This could be done very easily using the Marketo Forms2 JS library - 

 

 

MktoForms2.loadForm("pages.example.com", "AAA-BBB-CCC", <insert-form-id>, function(form) {
    form.onSuccess(function(values, followUpUrl) {
       var vals = form.getValues();
       if (vals.Field1 == "value1" && vals.Field2 == "value2") { //replace values & fields with the actual values
        	location.href = "https://example.com/page1"; //add thank you page1 URL
       } else if (vals.Field1 == "value3" && vals.Field2 == "value4") { //replace values & fields with the actual values.      
        	location.href = "https://example.com/page2"; //add thank you page2 URL
       }
       //add more conditional statements if required

        return false;
    });
});

 

Since this is not configured at the form-level, you'd need to add script on webpages using this form, contrary to the form-level updates which get applied to all the pages using form upon approving the LPs.