Open a new tab after form submission | Community
Skip to main content
February 11, 2013
Solved

Open a new tab after form submission

  • February 11, 2013
  • 11 replies
  • 4112 views
Is there any way to open a new tab with a form submission?  We have specific needs to track conversion that use a few different ways.  I know the Marketo conversion works if we stay on the same page, but a company we work with requires a different page to open to track.  Instead of forcing that person to go to a different website or refresh the current website, we'd like to open a new tab with the different website, enabling our partners to track conversion but keeping the user on the same page.  Can this be done?  If so, how?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by
Hi Kymberlee,

Quick update. The script below can be added as an HTML element in Marketo Landing Page, similar to my previous suggestion. However, this one is better because it will only open the new tab/window if no error messages are displayed when the form is validated for things like required fields or valid email address (which are built into many landing page templates):

<script type="text/javascript">
$jQ('#mktFrmSubmit').click(function() {
var mktErrorMsgContent = $jQ('.mktFormMsg').html();
if (mktErrorMsgContent != 'This field is required') {
window.open('http://www.marketo.com'); //<-- Change this to your url
}
});
</script>

I hope this addresses your objective.

Reade Triolo

11 replies

March 26, 2015
Hi All,

I am trying to get this to work with no luck here is my code can someone help me out?

<div id="mktForm" class="mktEditable">
      <script src="//app-ab01.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1842"></form>
<script>MktoForms2.loadForm("//app-ab01.marketo.com", "320-KOG-016", 1842);</script>
        <script type="text/javascript">
$jQ('#mktFrmSubmit').click(function() {
var mktErrorMsgContent = $jQ('.mktFormMsg').html();
if (mktErrorMsgContent != 'This field is required') {
window.open('http://xxx.xxx/xxx.pdf'); //<-- Change this to your url
}
});
</script>
      </div>

Thanks!
Eric