Hello,
we have a marketo landing with a form and we're embedding it with an iFrame.
We want the parent page (outside the iFrame) to be redirected once the form is submitted and we're using this script inside the marketo landing:
<script>
function setupFormSuccess (){
var formID = $('[name="formid"]').val();
var form = MktoForms2.getForm(formID);
if(!form){
setTimeout(setupFormSuccess, 500);
}else{
form.onSuccess(function (values, url){
window.top.location.href = url;
return false;
});
}
}
setupFormSuccess();
</script>
The problem is tha it is working correctly on chrome, but on firefox it doesn't always work and we can't find the error. Is there a better way to do this?
We do have set the forms exit page to the page we want, but the Marketo landing is inside an iFrame and we don't want to load the "thankyou" page inside the iframe but on the parent container!
I have this same exact issue. Has anyone found a workaround/solution for this?
The code above is broken. The seemingly erratic behavior in FF is probably because of the unnecessary setTimeout.
MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals,tyURL){
window.top.location.href = tyURL;
return false;
});
});