How to use Forms 2.0 JS API with Drupal form as content type | Community
Skip to main content
Vipin_Mp
Level 2
July 5, 2019
Solved

How to use Forms 2.0 JS API with Drupal form as content type

  • July 5, 2019
  • 1 reply
  • 3433 views

Can anyone know how to submit a lead using Forms 2.0 JS API (on the client side)  to the Marketo database directly, when someone submits Drupal form?

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

Sample of form markup is

<form action="https://pages.example.com/index.php/leadCapture/save" method="post">
<input type="hidden" data-comment="the numeric form ID" name="formid" value="9999">
<input type="hidden" data-comment="your Munchkin ID" name="munchkinId" value="123-AAA-456">
<input type="hidden" data-comment="the Thank You URL" name="retURL" value="https://www.example.com/thankyou">
<input type="hidden" data-comment="you must fill this with the current document.location.href if you want it logged in Marketo" name="_mktoReferrer" value>
<input type="hidden" data-comment="will be filled automatically with the Marketo cookie value, you need only include the field" name="_mkt_trk">
</form>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

where pages.example.com is your primary LP domain or a domain alias.

And of course you need to use the Marketo field names.

Don't know why you'd want to do it this way, as it means you need to make your Drupal form look (structurally) exactly like a Marketo form, which isn't very flexible and in some cases might not even be possible. If you want to use a custom form I recommend going fully custom and using the Forms 2.0 JS API method.

1 reply

SanfordWhiteman
Level 10
July 5, 2019

Submit a hidden Forms 2.0 form in the background,  as discussed in many other posts (have you searched?). 

Vipin_Mp
Vipin_MpAuthor
Level 2
July 8, 2019

Thank you San.. yup.. I have searched and thought like to save the details directly to the database without a hidden form.

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
July 8, 2019

Sample of form markup is

<form action="https://pages.example.com/index.php/leadCapture/save" method="post">
<input type="hidden" data-comment="the numeric form ID" name="formid" value="9999">
<input type="hidden" data-comment="your Munchkin ID" name="munchkinId" value="123-AAA-456">
<input type="hidden" data-comment="the Thank You URL" name="retURL" value="https://www.example.com/thankyou">
<input type="hidden" data-comment="you must fill this with the current document.location.href if you want it logged in Marketo" name="_mktoReferrer" value>
<input type="hidden" data-comment="will be filled automatically with the Marketo cookie value, you need only include the field" name="_mkt_trk">
</form>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

where pages.example.com is your primary LP domain or a domain alias.

And of course you need to use the Marketo field names.

Don't know why you'd want to do it this way, as it means you need to make your Drupal form look (structurally) exactly like a Marketo form, which isn't very flexible and in some cases might not even be possible. If you want to use a custom form I recommend going fully custom and using the Forms 2.0 JS API method.