AnsweredAssumed Answered

How to load 2 different forms in sequential order with Javascript

Question asked by John Wallace on Aug 6, 2014
Latest reply on May 24, 2015 by Sanford Whiteman

     Hi I am trying to create a sequential form by using two differnt forms.  I would like to use the forms 2.0 api to do so.  I have this so far...Can you grab an id or another form with in another one?

     <script src="//app-sjp.marketo.com/js/forms2/js/forms2.js"></script>
     <form id="mktoForm_333"></form>
     <script>
     MktoForms2.loadForm("//app-sjp.marketo.com", "466-AGZ-592", 333, function(form) {
         form.onSuccess(function(callback) {
             form.getFormElem().hide();
                //want to show the from below after submit
             });    
         });
      
     </script>
      
     <!-- second form -->
     <script src="//app-sjp.marketo.com/js/forms2/js/forms2.js"></script>
     <form id="mktoForm_334"></form>
     <script>MktoForms2.loadForm("//app-sjp.marketo.com", "466-AGZ-592", 334, function(form) {
         form.getFormElem().hide();
     });
      
     </script>

     Once the first from is submitted I would like to load the other one.  I know I have been bugging people but would like to avoid building multiple landing pages to create a seemless sequential form.  Would I need to use ajax to submit the first form then load the second one?  Thanks in advance

     -John

Outcomes