Form Follow up with to relative external Thank you Page URL

Prakash_Mohanda
Level 2

Re: Form Follow up with to relative external Thank you Page URL

Hi Sanford. hoping for an answer on this . thx !

Samantha_Cossum
Level 3

Re: Form Follow up with to relative external Thank you Page URL

Sanford Whiteman​, Is it possible to do this without it being a local page? We have implemented standard lead gen form that are used across a number of domains. All the thank you pages are relative to the domain the form is posted on but it could be posted on several domains so having it look at a "default" url and then just edit the path wouldn't work.

Right now we try to use choices but we have problems with the person crafting the campaign communicating where a page needs to go based on the utm and then automatically jumps to it being broken. Would love to give our web developer a fix up front that he can implement when he's creating the pages.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Form Follow up with to relative external Thank you Page URL

Is it possible to do this without it being a local page?

Of course, the code was simply written for the OP's needs.

If you want to stay on the same hostname that hosted the form (i.e. current hostname), and append the path + pagename + query from the Thank You URL, then do:

MktoForms2.whenReady(function(form){ 

  form.onSuccess(function(vals,tyURL){ 

    var tyLoc = document.createElement('A'); 

    tyLoc.href = tyURL; 

    tyLoc.protocol = document.location.protocol;

    tyLoc.host = document.location.host;

    document.location = tyLoc;

    return false; 

  }); 

});

Samantha_Cossum
Level 3

Re: Form Follow up with to relative external Thank you Page URL

This is awesome! Our web developer already tested it out and it worked like a charm so thank you!

Michael_Tucker1
Level 4

Re: Form Follow up with to relative external Thank you Page URL

HI Prakash Mohandas​,

I think that if you give this code a try instead of your standard Marketo embed form, that should redirect to the landing page you're talking about here:

<script src="//app-ab22.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_4"></form>

<script>MktoForms2.loadForm("//app-ab23.marketo.com", "876-MVP-978", 4, function(form) {

    form.onSuccess(function(values, followUpUrl) {

        location.href = "https://ibs.schwab.acsitefactory.com/get-started/thank-you";

        return false;

    });

});</script>

Does that help?

Michael

Michael Tucker