SOLVED

Re: Form Submission Error - Server Status 400

Go to solution
rkecontentguru
Level 2

Form Submission Error - Server Status 400

Hi Marketo Community, 

 

I have been experiencing intermittent form submission failures for Marketo forms on my corporate (non-Marketo Landing Page) site.

 

Form submissions generally function properly on our site. However, occasionally we receive the tooltips error message 'Submission failed, please try again later'.  We get this error message randomly, and can't identify a pattern or obvious reason why this would happen. This makes it very hard to reproduce and troubleshoot.

 

We were able to capture the console errors on a recent form submit failure (the screenshots are also below). The webpage the form is hosted on is this.

 

 

Failed to load resource: the server responded with a status of 400 ()
POST https://874-ytk-209.mktoweb.com/index.php/leadCapture/save2 400
send        @ forms2.min.js:7
ajax        @ forms2.min.js:7
(anonymous) @ XDFrame:42
dispatch:   @ forms2.min.js:6
q.handle    @ forms2.min.js:6

 

 

Form Submission Error.pngConsole Errors.png

 

Can anyone help identify the reason why these forms fail to submit?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Form Submission Error - Server Status 400

The problem is your site is an SPA (single-page app) and you’re continually creating additional Marketo form objects whenever someone navigates back to the form page.

 

The HTML <form> elements are removed from the DOM, but the form objects will never be removed and the forms library still thinks they exist.)

 

You need to make sure a single form object + <form> element pair are reused as new page content is injected & shown, rather than creating new ones.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Form Submission Error - Server Status 400

Is there any situation where you load additional forms on that page (a quick subscribe form, et al.)? This error is typically because you load forms from 2 different domains, i.e. your LP domain like pages.example.com and the Marketo builtin default 123-XOR-456.mktoweb.com. You should only be using the LP domain.

 

I couldn’t see another form being loaded when I checked your page just now, but your CMS may inject one under certain conditions.

rkecontentguru
Level 2

Re: Form Submission Error - Server Status 400

Hi Sanford, thanks for responding.

 

There is not a situation where we load additional forms currently - we have this in the pipeline, but it isn't live yet. 

 


You should only be using the LP domain.

When we initially implemented Marketo, we faced an issue where our forms would not work properly on any page when we used the standard embed link containing our LP domain. After consultation with our web-devs and Marketo support, the solution recommended was to replace the CNAME source references with our Marketo built-in domain in the embed codes. The embed code we use on our site for all forms looks like this: 

<script src="https://123-ABC-456.mktoweb.com/js/forms2/js/forms2.min.js"></script> <form id="mktoForm_2190"></form> <script>MktoForms2.loadForm("https://123-ABC-456.mktoweb.com", "123-ABC-456", 2190);</script>

 

Would this potentially cause the problems we are facing now?

rkecontentguru
Level 2

Re: Form Submission Error - Server Status 400

We have been able to reproduce the error reasonably reliably. If we click 2-4 links to any page on our corporate site in quick succession, then return to try and fill in our 'Book a Demo' form, the above errors are returned reliably. 

 

Hope this is helpful and thanks again for your help!

SanfordWhiteman
Level 10 - Community Moderator

Re: Form Submission Error - Server Status 400

Can you please get the body of the HTTP 400 response (from the Network tab)? It will give deeper details.

rkecontentguru
Level 2

Re: Form Submission Error - Server Status 400

Hi Sanford, thanks again for your help. 

 

Below are the screenshots.

 

rkecontentguru_1-1684839898944.png

rkecontentguru_2-1684839930834.png

rkecontentguru_3-1684839949968.png

rkecontentguru_4-1684839996893.png

rkecontentguru_5-1684840013818.png

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Form Submission Error - Server Status 400

The problem is your site is an SPA (single-page app) and you’re continually creating additional Marketo form objects whenever someone navigates back to the form page.

 

The HTML <form> elements are removed from the DOM, but the form objects will never be removed and the forms library still thinks they exist.)

 

You need to make sure a single form object + <form> element pair are reused as new page content is injected & shown, rather than creating new ones.