Simple web to lead using POST method | Community
Skip to main content
New Participant
July 3, 2018
Solved

Simple web to lead using POST method

  • July 3, 2018
  • 2 replies
  • 6918 views

Does marketo have a simple web-form  to new-lead option using POST method? I'm getting tired of all the scripts and inline styles and form conflicts etc of the form 2.0 to collect a simple email address. Other CRM's like zoho do this and it is very handy in a lot of instances. Thanks in advance!

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

Of course. The <noscript> variant of a Marketo form, posting to the HTTP-redirecting /save endpoint, is exactly that.

But it's a lot easier to use the Forms JS API to post a form in the background. You don't need your visible form to be a Marketo form. It can be a completely bespoke form, just capture the fields and relay them to a hidden Marketo form and call the Marketo form's submit(). This is a very common setup.

I don't know what you mean by "form conflicts" however.

2 replies

July 4, 2018

@Kenny Elkington​, now that we have the Push to Lead API, does that supercede your earlier post (/blogs/marketowhisperer/2015/09/30/make-a-marketo-form-submission-in-the-background)?

SanfordWhiteman
New Participant
July 4, 2018

Since Push Lead (like all REST APIs) requires that you build another entire other layer and implement rate-limiting and map form inputs in the same way, it surely is not a substitute in the general case.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
July 3, 2018

Of course. The <noscript> variant of a Marketo form, posting to the HTTP-redirecting /save endpoint, is exactly that.

But it's a lot easier to use the Forms JS API to post a form in the background. You don't need your visible form to be a Marketo form. It can be a completely bespoke form, just capture the fields and relay them to a hidden Marketo form and call the Marketo form's submit(). This is a very common setup.

I don't know what you mean by "form conflicts" however.

New Participant
July 3, 2018

Ahhh, Sanford with a great solution, every time. Where can I see some examples/documentation on the JS API, I'm no JS-wonder.

As for conflicts, multiple forms on one page, which can be avoided in other ways ideally though.

SanfordWhiteman
New Participant
July 3, 2018

The quickest jump into a background form post is here: Make a Marketo Form Submission in the background

However, it does leave out one important step, which is that the native HTML form's submit method needs to be stopped.

In other words:

<form id="visibleForm">

  <input name="whatever">

  <button type="submit">

</form>

<script>

  document.querySelector("#visibleForm").addEventListener("submit",function(e){

    e.preventDefault();

    // now you can continue to add fields to the Marketo form and call its submit(), and the HTML form won't also submit!

  });

</script>

As for conflicts, multiple forms on one page, which can be avoided in other ways ideally though.

With the fix here, multiple forms are no problem: Multiple Marketo forms, multiple times… on the same page