Re: Embedded Form Thank You Redirect

SanfordWhiteman
Level 10 - Community Moderator

Re: Embedded Form Thank You Redirect

Then have the Thank You URL be part of the OM embed code instead. Put it in a JS variable.

I'd never clone forms just to set Thank Yous. Maintenance nightmare.

James_Rubin
Level 1

Re: Embedded Form Thank You Redirect

Ok. This solved it:

MktoForms2.whenReady(function(form){
var formEl = form.getFormElem()[0];
var submitEl = formEl.querySelector('button[type="submit"]');
form.onSuccess(function(vals,tyURL){ 
    var loc = document.createElement('A'); 
    loc.href = tyURL; 
    window.location.replace("https://my-special-thank-you-page");

Thanks for the coaching!