SOLVED

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

Go to solution
Anonymous
Not applicable

How To Handle Multiple External Thank You Pages From a Single Form in an iframe

We use iframes with URL tokens in the SRC attribute to pass data. We want to keep doing that.

Currently, using the old forms (1.0?), we have a super-minimal Marketo Landing Page (nothing but the form) for each Thank You Page we want to target, and we enter the External URL in the Marketo Editor. All of these Landing Pages use the same Form (1.0) and just have different data passed into them.

With Forms 2.0, the FORM is where it wants us to input the External URL for thank you pages. I think I'd like the ability to pull the Thank You Page URL (retURL I've seen it called) from one of the parameters I'm passing into the iframe so that we can use just one form/LP for everything.

In the Forms 2.0 editor, the Form Settings tab does not seem to allow the option for pulling the URL from a URL token. I'm not sure how to proceed.

My Theory:
  1. Add a new hidden field (typage) that pulls from a URL token I'll add to the SRC field of the parent iframe
  2. In the 'Advanced Thank You Page' area of the Form 2.0 settings, create a conditional If/Then statement for that variable to indicate the proper URL.
  3. Repeat 400 times

Is there a better way to handle this?

I'd love to be able to set it and forget it by having the option to enter a variable into the 'Follow Up With:' field. Then I could just type in 'http://mysite.com/{{$typage}}/thankyou.php' or something and never need to look at Design Studio again for referring those links.
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Kenny_Elkington
Marketo Employee

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

It could work with an iframe, though I strongly discourage using it.  If you wanted to implement the snippet for an iframe I would switch from using the loadForm method to whenReady, and put it in an HTML block on your LP.

MktoForms2.whenReady( function(form){
  //Add an onSuccess handler
  form.onSuccess(function(values, followUpUrl){
    //Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl.
    location.href = "https://google.com/?q=marketo+forms+v2+examples";
    //return false to prevent the submission handler continuing with its own processing
    return false;
  });
});

You'd also need to your take desired location down from the querystring of the iframe in document.location to pass as a variable for your followup URL.  I'd strongly recommend using the embed code for your form though, unless your have a compelling need to iframe the form.

Regarding RF, I'm not familiar with how their code works, but it likely doesn't interfere since the form redirect fires on the onSuccess event which is after the form info has been submitted.

View solution in original post

4 REPLIES 4
Kenny_Elkington
Marketo Employee

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

Hey Corry,

You can set the redirect on the page itself by overriding the the URL with the forms 2.0 API.  An example snippet is shown in example 2 on this page: http://developers.marketo.com/documentation/websites/forms-2-0/
Anonymous
Not applicable

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

Thanks Kenny! Will that work with the iframe, or will we have to use the embed code?

Also, I'm not sure if you're familiar with ReachForce, but would you happen to know if this would interfere with it? I know that RF delays the submission of the form until its pop-up is dismissed, so I suspect it doesn't.
Kenny_Elkington
Marketo Employee

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

It could work with an iframe, though I strongly discourage using it.  If you wanted to implement the snippet for an iframe I would switch from using the loadForm method to whenReady, and put it in an HTML block on your LP.

MktoForms2.whenReady( function(form){
  //Add an onSuccess handler
  form.onSuccess(function(values, followUpUrl){
    //Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl.
    location.href = "https://google.com/?q=marketo+forms+v2+examples";
    //return false to prevent the submission handler continuing with its own processing
    return false;
  });
});

You'd also need to your take desired location down from the querystring of the iframe in document.location to pass as a variable for your followup URL.  I'd strongly recommend using the embed code for your form though, unless your have a compelling need to iframe the form.

Regarding RF, I'm not familiar with how their code works, but it likely doesn't interfere since the form redirect fires on the onSuccess event which is after the form info has been submitted.
Anonymous
Not applicable

Re: How To Handle Multiple External Thank You Pages From a Single Form in an iframe

Awesome. I'll start setting us up to switch to the embed code then, since my reason for sticking with iframes was just one of 'if it ain't broke, don't fix it' 🙂

Thanks a bunch!