Good Afternoon,
In the Forms 2.0 you can follow up a form submission with a thank you page. If i set my follow up to an external URL is there anyway for that page to open up in a new tab instead of the same tab with the form. If coding on an email or website I use the
<a href="www.google.com/" target="_blank">
I am asking because we have a marketo form embedded in a lightbox on our website and when we click submit it takes us to an external URL but within the same tab, it would be better if it came up in a new tab.
Thanks,
Evan
I am asking because I have a marketo form
This has always been solid for me, the reload is to close the lightbox in the original window. or you can replace the reload with $('.mktoModalClose').modal('hide');
<script src="//app-sj07.marketo.com/js/forms2/js/forms2.min.js"></script>
<script>
function Form() {
MktoForms2.loadForm("//app-sj07.marketo.com", "0000-TDW-0000", 0000, function (form){MktoForms2.lightbox(form).show();
form.onSubmit(function (){window.open('', 'myWindow');
});
form.onSuccess(function(values, followUpUrl){window.open('www.google.com', "myWindow" );
location.reload();
return false;
});
});
}
<script>
-----html-----
<button onclick="Form();">View</button></h1>
</div>
Forgot to mention
IMPORTANT! to avoid pop up blocker, do not use "If known visitor show custom HTML"
In the example i did put "google.com" but you must use a Marketo LP (same domain), and if you want to go to somewhere else you must redirect it.
There's no such restriction, Diego. As long as you follow the correct pattern you will avoid pop-up blockers regardless of whether the Thank You URL is on an external URL and/or whether you use KL HTML.
See the existing demo MktoForms2 :: Thank You New Window
Yes, that uses the same pattern as in the solution, although you don't need the second window.open once you have a reference to the window.
Is this code in addition to the embed code for the light box form?
Hi Kim, I'm not a developer but the embed code is actually already included in that code (see below). The top two lines are calling the form to load up in a lightbox based on marketos API and the bolded below is the unique identifier for our specific company forms. So when you're in design studio and you right click on a form 2.0 and click embed code and go to the lightbox drop down you will see those two lines but with your form ids instead.
Then below that is, the code calls for once the form has successfully been filled out then it will open a thank you page, which in our case we set as our product brochure PDF.
MktoForms2.loadForm("//app-abc.marketo.com", "195-NER-971", 2497, function (form {
MktoForms2.lightbox(form).show();
form.onSuccess(function(followUpUrl){
window.open('yourThankyoupage','_blank' );
});
});
Hi Sanford, can you link me to any work around you have?
I see what you're saying. Our dev team also told us the same thing and we proceeded with the form redirecting to the PDF and navigating the user away from our site in this case because of the pop up issue. So we actually never solved this thread.
The solution is in the other thread.
It doesn't actually work, though, because any sensible browser will block that as a popup, killing the UX. I have explained the technical reasons why in other posts, if you search for them, and the way around it.
MktoForms2.loadForm("//app-abc.marketo.com", "195-NER-971", 2497, function (form){MktoForms2.lightbox(form).show();
});
How do we get the "result page" to open in a new window?