5 Replies Latest reply on Mar 27, 2016 9:59 PM by Sanford Whiteman

    What is the preferred way to handle multiple form submits

      Hello all,

       

      We are using the form js to embed forms in to our site as modals. Our marketing team want to reuse a single formId in multiple areas and has asked to not show the form after the 1st submit but to send the data to marketo. I know we can get the vals() from the first form submission, push it in to session storage and reuse it for the rest of their session. However are there any other options that are preferred? Is there a anything we should do with submitting into through munchkin?

       

      Thanks

       

      Jeff

        • Re: What is the preferred way to handle multiple form submits
          Grégoire Michel

          Hi Jeffery,

           

          Just let the form submit, and on submit, hide it. Tis can be done with some JS, using the forms 2.0 API: http://developers.marketo.com/documentation/websites/forms-2-0/

           

          The API doc just give this example:

           

          MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {

             // Add an onSuccess handler

            form.onSuccess(function(values, followUpUrl) {

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

            form.getFormElem().hide();

             // Return false to prevent the submission handler from taking the lead to the follow up url

             return false;

             });

          });

           

          -Greg

          1 of 1 people found this helpful
            • Re: What is the preferred way to handle multiple form submits

              Sorry I wasn't clear. We do want allow multiple submissions on the same form id. we are using bootstrap modals the call to action will spawn the bootstrap modal and the form is in it.

              • on new session use clicks call to action (CTA) button
              • bootstrap modal appears with embedded marketo form using formId 1234
              • user submits form modal is dismissed and a success message is shown or we redirect to a document

              This is all coded and working. Here is what we want to add for additional submits

              • user clicks on a different CTA but it also uses formId 1234
              • we immediately show a success message is shown or we redirect to a document

               

              In this second scenario what is the advised way to do it. Do we do the following:

              • on form submit, use vals function to pull the values in the initial form
              • store the values in session storage
              • next time the a CTA with same form id 1234 is clickedfollow a different flow
              • supress the modal appearing
              • prepopulate the form valsues
              • submit the form
              • All user sees is a success message is shown or we redirect to a document

              Or is there a different way that is suggested using say a munchkin call, or something from the server side?

               

              Thanks