SOLVED

Global Form Thank You Page Re-Direct

Go to solution
Keith_Nyberg2
Level 9 - Champion Alumni

Global Form Thank You Page Re-Direct

Hey Community,

Our company is in the process of migrating all of our landing pages from Drupal into MKTO. As our "Number of employees" thresholds change roughly every 6 months, we use Global Forms to limit the number available across our website. We are now starting to broaden the number of landing pages to customize the content specific to ads the prospects are clicking through. Here is my question...

How can I direct prospects to the Thank You page that matches the Landing page without touching the Global form? Our web designer enabled this on our Drupal forms by hardcoding the Thank You page into the form embed code of the original Landing page.

Does anyone have an easy way to do this? I know I want the form submitted on Xa page to direct to Xb thank you page but as I mentioned, do not want to modify the global form as we want to enable 1 form to live on 100s of landing pages.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Global Form Thank You Page Re-Direct

Couldn't be easier:

form.onSuccess(function(vals,thankYouURL){

    switch(document.location.pathname) { // or whatever you want to use to detect current page

    case '/mightyfine.html':

          document.location = '/thanks-mightyfine.html';

          break;

    case '/redredwine.html':

          document.location = '/thanks-redredwine.html';

          break;   

     ...

     }

    return false;

});

See the Forms 2.0 API docs.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Re: Global Form Thank You Page Re-Direct

Keith Nyberg​ FYI. I moved your post to Products and Support​ so you get an answer faster..

Keith_Nyberg2
Level 9 - Champion Alumni

Re: Global Form Thank You Page Re-Direct

Thanks Scott! Airhead move by me...

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Form Thank You Page Re-Direct

Couldn't be easier:

form.onSuccess(function(vals,thankYouURL){

    switch(document.location.pathname) { // or whatever you want to use to detect current page

    case '/mightyfine.html':

          document.location = '/thanks-mightyfine.html';

          break;

    case '/redredwine.html':

          document.location = '/thanks-redredwine.html';

          break;   

     ...

     }

    return false;

});

See the Forms 2.0 API docs.

Keith_Nyberg2
Level 9 - Champion Alumni

Re: Global Form Thank You Page Re-Direct

Hey Sanford! Thanks for the post. I tried with our web developer and ended up using the code documented in the Developers: Marketo For Website > Forms 2.0 which had a little more detail which helped us. Forms 2.0 » Marketo Developers

The code looks like this...

  1. MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {
  2.    //Add an onSuccess handler
  3.   form.onSuccess(function(values, followUpUrl) {
  4.    // Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
  5.   location.href = "https://google.com/?q=marketo+forms+v2+examples";
  6.    // Return false to prevent the submission handler continuing with its own processing
  7.    return false;
  8.    });
  9. });

We actually piggy backed the function(form) { onto our form embed code which we have tokened and it works great without touching the templates.

Sarah_Greig2
Level 3

Re: Global Form Thank You Page Re-Direct

I have a global form which is used on translated landing pages. The form on submit goes to an external thank you page (english language). Could I use this solution to force the form on submit to go to each of the separate translated thank you pages?

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Form Thank You Page Re-Direct

Of course!  Hopefully, your localized pages have a consistent part of the path (or query string) so you can change the Thank You URL accordingly (e.g. lp.html?lang=en goes to thankyou-en.html, etc.).