What is the preferred way to handle multiple form submits

Jeffery_Werner_
Level 2

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

Tags (2)
5 REPLIES 5
Grégoire_Miche2
Level 10

Re: What is the preferred way to handle multiple form submits

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

Jeffery_Werner_
Level 2

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

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the preferred way to handle multiple form submits

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.

Jeffery_Werner_
Level 2

Re: What is the preferred way to handle multiple form submits

so how do you pass the values to marketo after the first form submit.

The customer could push a call to action on various pages.

So how do we get the values sent to marketo. Please point me to a document or page that walks through how to track additional requests if I dont need to resubmit.

Also I looked at the document you refered to "Make a Marketo Form Submission in the background. " and based on that code you need to pass through the values for the form and auto submit. So to me that sounds like I need to store them in some method (sessionStorage or otherwise). If that is not the case please point me to where I can get more info.

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the preferred way to handle multiple form submits

If you know the lead's identity on the page where you gather field values -- either [1] because you know they have previously submitted a form or clicked an email link, so their session is already associated, or [2] because one of the values is their email address -- then there's no reason to transfer those values from page to page using sessionStorage or an equivalent mechanism.  You just post them to Marketo, then and there.

I don't understand the situation in which you want to delay updating fields on a known lead.  By delaying, you just risk them closing their browser in the meantime, so you never get the latest values. In contrast, if you update the known lead continually, you'll always have the latest values, and if you want to log that they've clicked a particular CTA, then either use a form post or a Munchkin call to log that interesting event -- and that event only.