How to close a popup with a marketo form after form is submitted? | Community
Skip to main content
Kat_Narvaez
Level 2
June 5, 2017
Question

How to close a popup with a marketo form after form is submitted?

  • June 5, 2017
  • 1 reply
  • 3736 views

Hello,

I have a Marketo form embedded on a popup in our site, using a Wordpress plugin (popup maker). When someone submits the form, I'd like the popup to close and stay on the current page. I'm basically trying to do the same thing here: http://developers.marketo.com/blog/hide-lightbox-after-form-submission/  but instead of using the marketo lightbox, I'm embedding the form in our own popup. Has anyone tried/done this?

Thanks,

Kat

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
June 5, 2017

Of course: just call your popup/lightbox library's close method in MktoForms2.onSuccess.

Kat_Narvaez
Level 2
June 9, 2017

I tried that but the form it's still doing whatever I set up on my form inside Marketo. This is my code:

<script src="//app-ab19.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1335"></form>

<script>MktoForms2.loadForm("//app-ab19.marketo.com", "497-SKV-262", 1335, function (form){form.onSuccess(function(){jQuery('#popmake-1310').popmake('close');});});</script>

SanfordWhiteman
Level 10
June 9, 2017

That's​ a different question. If you want to suppress the default success action (that is, redirecting to the Thank You URL) then return false in onSuccess after closing the lightbox.