Global Form Thank You Page Re-Direct | Community
Skip to main content
keithnyberg
New Participant
June 26, 2015
Solved

Global Form Thank You Page Re-Direct

  • June 26, 2015
  • 2 replies
  • 4839 views

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!

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

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.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 27, 2015

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.

keithnyberg
New Participant
June 30, 2015

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 = "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.

June 26, 2015

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

keithnyberg
New Participant
June 26, 2015

Thanks Scott! Airhead move by me...