SOLVED

Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

Go to solution
Doug_Flowers
Level 1

Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

I have seen a few old threads suggesting this endpoint still exists but the only method of lead creation that Marketo seems to support in the docs is using the javascript library.  We have a version of that working if we have to, but we are hoping that it is still possible to simply post directly to a Marketo endpoint from the HTML form without loading Marketo's javascript library. Does such an endpoint still exist?

An older thread led me to believe that a path like: https://{our-instance}.marketo.com/index.php/leadCapture/save2&formid={our-form-id}&munchkinId={our-...  would be the endpoint we are looking for, but when we try to post a form submission to this endpoint from a form on our site, the request fails and we get this error in console:

"Mixed Content: The page was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Open+Sans:300'. This request has been blocked; the content must be served over HTTPS."

That leads me to believe we are either hitting the wrong endpoint or not properly authenticated to make this request. But is there a way to do so that doesn't involve loading the javascript? For the record as far as the post-submission redirect page goes, we are using our own hosted on our site and it does not use this font. 

 

Thanks in advance to any insight!

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

Not /save2, /save. You will not be able to make use of the /save2 endpoint outside of the Forms 2.0 JS library.

Search my many old posts on the legacy (scriptless) /save endpoint.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

Not /save2, /save. You will not be able to make use of the /save2 endpoint outside of the Forms 2.0 JS library.

Search my many old posts on the legacy (scriptless) /save endpoint.

Doug_Flowers
Level 1

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

Sanford, thank you for the quick reply!  

I just had a chance to tinker with that.  I am still getting the same 404 error about mixed content, request blocked. Any familiarity with that particular error in this context?   Pretty straightforward what I'm doing with the form but just for reference, this is how I have my form set up:

<form action="https://app-ourPodId.marketo.com/index.php/leadCapture/save&formid=XXX&munchkinId=XXX-XXX-XXX" method="post" role="form" class="form-with-phone" >

// fields here

</form>

Anything noticeable off there? Same issue whether I send to save or save2.  I read some of your previous posts explaining the benefits of the forms 2.0 api and using the js library but would like to have this scriptless option if at all possible. Reading your posts, it does sound like it is! But I can't quite figure out what we're doing wrong here and what this error is telling us.  No issues 301 redirecting to our page using the 2.0 api and forms library for the record, so I don't think it's actually an issue with content on that page. (It also doesn't use the font referenced in the error, further confirming this.)

Thank you again for taking the time to assist this!

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

You don't want the query string in the action.

<form action="https://example.com" method="post">
<input type="hidden" name="munchkinId" value="123-aaa-456">
<input type="hidden" name="formid" value="666">
<!-- etc. -->
</form>
Doug_Flowers
Level 1

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

This is it!  Thank you.  Makes perfect sense as well.

Hopefully last question for ya:  While these forms are now leadCapturing with no issue, the 301 redirects are now not firing from Marketo. The page just reloads after successfully submitting form like there is no 301 response.

Is that expected behavior on legacy endpoint?  Would we need to handle on our end manually since we are using legacy endpoint? Or should these Marketo UI defined 301Thank You Pages should still work here? They were working as expected using the forms 2.0 api with js lib if that helps. Any other custom configuration you are aware of we would need to add to get those firing again using legacy method?

We do have two different thank you pages for this campaign depending on the user's answer to one of the questions in the form, possible that could be gumming things up a bit I suppose?

Thank you again for your help on this! Much, much appreciated.

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

The Thank You URL logic from Form Editor isn't used in this context. Include the hidden field retURL to set the Thank You.

Doug_Flowers
Level 1

Re: Is it possible to POST form submission to Marketo endpoint directly from HTML form without loading Marketo's forms2.min.js?

You nailed it again!  Thank you so much for the help on this Sanford. 

Very helpful for me to be able to present both of these options to our team as we work through our on-boarding.