SOLVED

When does a Cookie meet and match it's lead?

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: When does a Cookie meet and match it's lead?

There's no Marketo form on that page, only a (rather mangled) attempt to use a custom HTML form directly with the Marketo forms endpoint.

It's not surprising that it's not working, because you really have to know what you're doing to put that together (and in this case it definitely is not cross-browser compatible).

The correct way to integrate a custom form with the Marketo forms infrastructure is to use a hidden Marketo form and post it in the background.

Anonymous
Not applicable

Re: When does a Cookie meet and match it's lead?

Cool thanks a lot! We'll let you how it goes, but going to suggest this http://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/

SanfordWhiteman
Level 10 - Community Moderator

Re: When does a Cookie meet and match it's lead?

Yes, that's the baseline approach.

Josh_G
Level 2

Re: When does a Cookie meet and match it's lead?

Hey Sanford,

I've looked at that doc many times and I find it frustrating it doesn't include an example for triggering off a basic POST for the visible form, nor does include how to pass the user inputs from the visible form to the Marketo form.

The code presented uses pre-defined hidden field values for submission rather than user inputs.

This information would be enough for skilled devs, but for code monkeys like myself I need more!

Any chance you could direct me to a resource that would explain that, or could you show me a quick sample?

SanfordWhiteman
Level 10 - Community Moderator

Re: When does a Cookie meet and match it's lead?

Here's a brief(ish) example of an HTML form, with several different native input types, that's mapped to a hidden Marketo form on the HTML form's submit event:

     MktoForms2 :: Basic HTML form to Marketo form

On the left-hand side is the HTML form, on the right-hand side the Marketo form.

To make the demo more informative, I've set the Marketo form to opacity:.5 rather than full display:none which you'd use in production. I also added all the fields to the Marketo form in Form Editor as type Text: this wasn't necessary for the code to work, as they'll be added to the field as type Hidden automatically if they don't exist, but by making them visible you can see them update live.

When you press Submit on the HTML side, the Marketo side grabs the HTML values and maps them to their Marketo equivalents (for example, a set of <input type="checkbox"> with the same name becomes a multivalued semicolon-delimited string field for Marketo).

As you can see, the HTML side uses the native required attribute to prevent submission. There are other bells and whistles, including the use of a custom Event, which probably won't make sense until you get quite a bit more experience with JavaScript in the browser.

If you have more questions on this, please open a new thread as it really isn't pertinent to the old thread's topic.