Re: Open New Tab After Form Submission for Downloads

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

I have this post in Draft mode, look for it this weekend:

 

SanfordWhiteman_0-1619730001900.png

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

Anonymous
Not applicable

Re: Open New Tab After Form Submission for Downloads

Hi Sanford,

I also have added a form to a marketo landing page, which is being used off a template they created for us. When I attached the PDF url for the form submission (as external URL), it opens in the same window. I prefer the document open in either a new window/tab. How do you suggest I go about this? And if it's adding some code to the landing page, since it is a template, would that code be added in the "Custom HEAD HTML" section?

Thank you,

Kevin

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

It's same code as above, except you're using the form-level followUpUrl as is instead of overriding it in the code. Thus change:

form.onSuccess(function(vals,followUpUrl) { 

  thankYouWindow.document.location = 'http.example.html';      

});

to this:

form.onSuccess(function(vals,followUpUrl) { 

  thankYouWindow.document.location = followUpUrl;      

  return false;

});

You have to put the code block after the forms library is loaded. Thus in these cases the safest place to put the <script> is actually right before the closing <body> tag.

Anonymous
Not applicable

Re: Open New Tab After Form Submission for Downloads

Hi Sanford,

Thank you for the quick reply. Sorry for my ignorance (and the fact, I am

not a developer), but what code exactly that you mention above? Here is the

landing page url: http://lp.zilliant.com/AI_Delivers.html

The form lives on this LP, and since I am using a template, where exactly

am I placing the code? I don't have access to edit in the HTML unless I

update the main template code. Is this where you suggest this code be

placed? And if I do update in the main template, will that carry over to

the new LP I created using the main template? There is a Custom head HTML

section in the newly created LP settings.

Thank you,

Kevin

On Mon, Mar 6, 2017 at 2:16 PM, Sanford Whiteman <

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

what code exactly that you mention above?

The code in the post right above yours in this thread.

The form lives on this LP, and since I am using a template, where exactly

am I placing the code? I don't have access to edit in the HTML unless I

update the main template code. Is this where you suggest this code be

placed? And if I do update in the main template, will that carry over to

the new LP I created using the main template? There is a Custom head HTML

section in the newly created LP settings.

You can put the code in the template, before the closing <BODY> tag. Note it will (by definition) apply to all LPs based on this template, after you reapprove them.

Custom <head> is the opposite of <body>.  You can put it in the <head> but then you need slightly more complex code.

Anonymous
Not applicable

Re: Open New Tab After Form Submission for Downloads

Okay that makes sense. Do I just replace the form info in the below code?

MktoForms2.loadForm("//app-sj11.marketo.com", "433-ODK-889", 1133);

And do I need this code as well even though it is not a lightbox?

MktoForms2.lightbox(form).show();

On Mon, Mar 6, 2017 at 2:36 PM, Sanford Whiteman <

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

You don't replace the default embed code -- the MktoForms2.whenReady() call is in addition to the MktoForms2.loadForm() call.

Right, if you're not using a lightbox, you don't need the lightbox line.

Anonymous
Not applicable

Re: Open New Tab After Form Submission for Downloads

I meant do I replace the following "//app-sj11.marketo.com", "433-ODK-889",

1133 in the *MktoForms2.loadForm section. It looks like that form info

pertains to the other persons form ID, correct.*

*Sorry for any confusion or to be a pain, but I am just trying to

understand this so I don't create any errors. I do appreciate your help.*

Kevin

On Mon, Mar 6, 2017 at 2:52 PM, Sanford Whiteman <

SanfordWhiteman
Level 10 - Community Moderator

Re: Open New Tab After Form Submission for Downloads

Oh, of course you use your own embed code with your own Munchkin ID et al.