Using blank Marketo forms in tandem with existing website forms

Renee_Sullivan1
Level 1

Using blank Marketo forms in tandem with existing website forms

Hi All

We are transitioning from web based forms to Marketo forms. We would like to know best practices around the implementation of a blank Marketo Form to collect the data from an already existing form and getting it into Marketo.

Keeping in mind that this is a short term solution as we transition totally to Marketo forms.

Thanks in advance!

Tags (1)
2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Using blank Marketo forms in tandem with existing website forms

There's no single best practice besides "accurately map the non-Marketo form's field names and current values to the corresponding Marketo names and values."

At a high level, it looks like this:

<form id="yourHtmlForm">

  <! -- all your non-Marketo field names and types are here -->

  <input name="submit" type="submit">

</form>

<form id="mktoForm_78787" class="mktoForm" style="display:none;"></form>

<script id="mktoForms2Lib" src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>

<script>

MktoForms2.loadForm("//app-sj01.marketo.com", "AAA-BBB-CCC, 78787);

MktoForms2.whenReady(function(mktoForm){

  var htmlForm = document.querySelector("#yourHtmlForm");

  htmlForm.addEventListener("submit",function(e){

    var mktoFieldsObj = {};

    /* set keys + values in mktoFieldsObj object from names + values in htmlForm */

    mktoForm.addHiddenFields(mktoFieldsObj);

    mktoForm.submit();
    e.preventDefault();

  });

});

</script>

But the complexity depends entirely on how your current form is set up, which input types you're using, and any existing JS you may have to re/assemble values before submission. That's the /* fill in names and values */ part and there's no one-size-fits-all.

Floyd_Alvares2
Level 8

Re: Using blank Marketo forms in tandem with existing website forms

Hi Renee,

Is there a reason why you want to move totally to Marketo Forms? I am assuming this means you plan on creating Marketo Forms with fields and embedded them into your website and replace the blank Marketo forms?

I would potentially recommend this scenario

  1. Keep the current web based forms but make sure they will submit to a blank Marketo form on the back end (example provided by Sanford). You do not need to replace these forms with pure Marketo forms as they will work exactly the same
  2. Create new Marketo forms for any new pages OR you would leverage the same process as in point 1.

Things to keep in mind

  • You will need to use SOAP API names if you are using the Forms 2.0 API
  • Your Smart Campaigns / Workflow should would contain logic such as "Fills out Form, with a constraint, Referrer is" to drive your logic. This will allow you to use the same blank form in Multiple places but drive the logic based on the webpage that the form actually resides in.
  • If you have workspaces, you would need individual blank Marketo forms for each workspace so that the lead can enter into the right workspace.

Reference materials for the forms 2.0: http://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/ in addition to what Sanford has provided.

Thanks

Floyd