Can you insert field data into forms api submit() function | Community
Skip to main content
Justin_Eichelb1
New Participant
June 16, 2020
Solved

Can you insert field data into forms api submit() function

  • June 16, 2020
  • 1 reply
  • 5541 views

My company's current process is: 

  1. Custom form on website
  2. On Submit, we push the data to our own database
  3. A custom procedure manages the Person create/update, merges the anonymous record, creates a custom activity that mimics a marketo form fill.

We capture the Marketo cookie id (forgive me for not using exact terminology here) in order to merge the anonymous record via the API call.

We have an oppty to update step 3 of the process and I now want to change to simply submit the form data and hopefully the cookie id.

Here is my layman’s layout of the new process.

Assume a simple form with only first name and email fields on it.

.submit(

formID: 1234

marketoCookieID: 123-2345-234,

firstName: JJ,

email:jj@domain.com

)

 

My questions to the community.

  1. Does the Marketo form API work this way? I can’t find any examples or
  2. If no, is there a better method other than HTTP POST?  I’ve done that in the past for a customer.  But I don’t believe you get a response. 
  3. How can we merge the anonymous record in this process?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

 

<form id="mktoForm_789" style="display:none;"> <script src="//pages.example.com/js/forms2/js/forms2.min.js"></script> <script> MktoForms2.loadForm( "//pages.example.com", "123-ABC-456", 789 ); MktoForms2.whenReady( function(form) { form.addHiddenFields({ Email : "user@example.net" }); }); }); </script>

 

The object passed to addHiddenFields uses the form field names, which are the same as the SOAP names.

 

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 16, 2020

 

<form id="mktoForm_789" style="display:none;"> <script src="//pages.example.com/js/forms2/js/forms2.min.js"></script> <script> MktoForms2.loadForm( "//pages.example.com", "123-ABC-456", 789 ); MktoForms2.whenReady( function(form) { form.addHiddenFields({ Email : "user@example.net" }); }); }); </script>

 

The object passed to addHiddenFields uses the form field names, which are the same as the SOAP names.

 

Justin_Eichelb1
New Participant
June 16, 2020

Thanks Sanford, 

 

So, if I repeat it back to you....

 

Given that this process is happening downstream from the website page being submitted, 

the 'post-form submit procedure' will gather the data from our database, then

inside a php file, we will create a form, adding the data back into hidden fields, then

automatically submitting the form.

 

If i'm correct, then i only have one more question.  Can i pass the anonymous munchkin person id in the form as a data field and will marketo handle the merge?  or will i have to do that in another process once i get a success response with the person id?

 

BTW, if you haven't been told recently, you are appreciated in the Marketo Community.

 

SanfordWhiteman
New Participant
June 16, 2020

Given that this process is happening downstream from the website page being submitted, 

the 'post-form submit procedure' will gather the data from our database, then

inside a php file, we will create a form, adding the data back into hidden fields, then

automatically submitting the form.


That would work, yes. And it automatically includes the cookie. You don't need to do anything special.

 

BTW, if you haven't been told recently, you are appreciated in the Marketo Community.


Thanks!