Form Thank You Page - External URL In New Window? | Community
Skip to main content
February 5, 2015
Question

Form Thank You Page - External URL In New Window?

  • February 5, 2015
  • 5 replies
  • 5249 views

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 post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

February 5, 2015
you can use the API for this:  

form.onSuccess(function(followUpUrl){
window.open('yourThankyoupage','_blank' );
});
February 6, 2015
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?

February 6, 2015
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 6
June 24, 2016

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

June 24, 2016

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

   });
});

February 6, 2015
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?
February 11, 2015
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 5
July 21, 2016

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>

SanfordWhiteman
Level 10
July 21, 2016

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.