Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Matt_Lyman
Level 2

One form on many (non marketo) pages redirecting to different (non marketo) page

We are using a standard form inside of multiple modals on our website. One of these modals needs to redirect to a different landing page than the others. None of these pages are hosted in Marketo, just the forms.

I know we can do redirects on the form, however, we don’t want it throughout ALL uses of that form, just on one.

Have any of you solved this?

8 REPLIES 8
Grégoire_Miche2
Level 10

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Hi Matt,

I gather that the forms are embedded.

This means you are using the forms 2.0 api to do so.

One of the examples given here Forms 2.0 » Marketo Developers  explains how you can reroute the follow-up page. You can start from this. Il will require some Js capabilities.

-Greg

Kenny_Elkington
Marketo Employee

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Example 2 shows this capability.  I suggest modifiying it somewhat and using the following instead:

  1. MktoForms2.whenReady(function(form) {
  2.    // Add an onSuccess handler
  3.   form.onSuccess(function(values, followUpUrl) {
  4.    // Get the form's jQuery element and hide it
  5.   form.getFormElem().hide();
  6.    // Return false to prevent the submission handler from taking the lead to the follow up url
  7.    return false;
  8.    });
  9. });

You will need to set followUpUrl to equal the URL of the page you want to redirect to.

Anonymous
Not applicable

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

I understand this for thank you pages, but what about deploying an auto responder email with the asset based on query string parameters or JS code? Has anyone done this?

SanfordWhiteman
Level 10 - Community Moderator

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Sure, why not? Constrain the Filled Out Form trigger by Web Page, use a Visit Web Page trigger on the Thank You URL, or read a filled-out field from the lead record. Lots of ways.

SanfordWhiteman
Level 10 - Community Moderator

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Matt, if the page happens to have a unique query param you can also do this without JS:

- add hidden field, enable Autofill to get value from the query param

- under Thank You Page, click Add Choice and switch the URL based on the hidden field's value

Courtney_McAra4
Level 4

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

This sounds intriging to me but can you confirm

The query parameter is anything after the? in the URL, correct?  such  as www.mywebsite.com/resources/awesome-case-study.html?content=5555. 

Where i know content 5555 means direct them to TY Page with the right PDF, or whatnot.

What if someone happens to go the URL and doesn't have the query piece after the ?.  

SanfordWhiteman
Level 10 - Community Moderator

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

Query parameter​s are all after the ?, yes.  Like key=value&key2=value2, etc.

If the query parameter is not present, you'd just send them to a default choice.

Courtney_McAra4
Level 4

Re: One form on many (non marketo) pages redirecting to different (non marketo) page

thanks Sandford!