Re: Form Thank You Page - External URL In New Window?

Anonymous
Not applicable

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 

Tags (1)
17 REPLIES 17
Anonymous
Not applicable
with Javascript sure, anything is possible.  my preference is to use jquery selectors ...something like this.....
adding CSS:
$( "#IDofLightboxDiv" ).css("width",90px);

adding a header to a specific container
var header = "<h2>This Is my Header</h2>";
$(
"#IDofContainerDiv" ).prepend(header);

 
Diego_Lineros2
Level 7

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>

Diego_Lineros2
Level 7

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.

SanfordWhiteman
Level 10 - Community Moderator

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

SanfordWhiteman
Level 10 - Community Moderator

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.

Anonymous
Not applicable
Thank you, we are trying to implement that now. Do you know if there is a way to change the dimensions of the lightbox and add a heading above the form but within the lightbox?
Anonymous
Not applicable
MktoForms2.loadForm("//app-abc.marketo.com", "195-NER-971", 2497, function (form {
   MktoForms2.lightbox(form).show();

   form.onSuccess(function(followUpUrl){
window.open('yourThankyoupage','_blank' );
   });
});
Kim_Gandy1
Level 7

Is this code in addition to the embed code for the light box form?

Anonymous
Not applicable

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' );

   });
});

SanfordWhiteman
Level 10 - Community Moderator

pastedImage_0.png

Kim_Gandy1
Level 7

Hi Sanford, can you link me to any work around you have?

SanfordWhiteman
Level 10 - Community Moderator
Anonymous
Not applicable

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.

SanfordWhiteman
Level 10 - Community Moderator

The solution is in the other thread.

SanfordWhiteman
Level 10 - Community Moderator

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.

Anonymous
Not applicable
Thank you for the reply. We are still having some trouble implementing this onto our site. This is the code we are using.
 

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?

Anonymous
Not applicable
you can use the API for this:  

form.onSuccess(function(followUpUrl){
window.open('yourThankyoupage','_blank' );
});