1 Reply Latest reply on Aug 11, 2016 1:51 PM by Sanford Whiteman

    Prevent Marketo Form loading too many times?

      Hi everyone, not too great with javascript, and looking for help from anyone who is willing to.

      I have a Marketo form code that works great on all my pages. It is responsive and displays a message after submit. I was assigned to create a form also to be loaded from a modal/lightbox. But every single time I close the lightbox and load it again, the form is being displayed twice.


      So my question is, how would I in a way clear my form after closing lightbox? Or reset all values after on load? Does this make sense? I want the form to load only once every time it is being called. Thanks for your help.





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

      <script>MktoForms2.loadForm("//app-sj08.marketo.com", "861-RWS-699", 1261, function(form) {});</script>





                <div class="boxPadding" style="background-color:#FFF; margin:0px 40px 0px 40px;">




              <!--  1 COLUMN-->



                  <form id="mktoForm_1261"></form>



                  <ul class="mktoUL">


                                  <p id="confirmform" style="visibility:hidden;"><span class="paddingArticlePage"><span class="paragraphArticlePage"><b>Thank you. You are now subscribed to Nanette Abuhoff Jacobson Commentary.</b></span></span></p>









                <!--  END 1 COLUMN-->







          <!-- on submit hide form and show hidden div -->





      MktoForms2.whenReady(function (form){



      //Add an onSuccess handler

        form.onSuccess(function(values, followUpUrl){

         //get the form's jQuery element and hide it


      document.getElementById('confirmform').style.visibility = 'visible';

         return false;