What is the preferred way to handle multiple form submits | Community
Skip to main content
mhe_jwerner
Level 2
March 25, 2016
Question

What is the preferred way to handle multiple form submits

  • March 25, 2016
  • 1 reply
  • 3964 views

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

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

1 reply

Grégoire_Miche2
Level 10
March 25, 2016

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

mhe_jwerner
Level 2
March 25, 2016

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

SanfordWhiteman
Level 10
March 25, 2016

There's no reason to repost the form with values (and thus no reason to keep them in session storage). 

If you must have a Filled Out Form activity appear, even though the user didn't see the form, then Make a Marketo Form Submission in the background.  With a hidden form you may want to add a hidden field like _formvis="hidden".  This field will be stored in the Activity Log details, which will keep you a little saner when trying to figure out the origin of a form post.