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!
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.
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
Things to keep in mind
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