Open maxstrebel opened 1 month ago
That's correct behaviour - at least for the moment. The reason is because it's trying to get a response for a form submission for a page that's in live preview, and it'll fail. If you inspect the network request, you'll see that it's returning the HTML of the page you're previewing, rather than a JSON response.
Basically - forms don't really work in live preview.
Thanks for the quick reply. As this also happens if you have preview link (outside of live preview, if you click on "View"), I would like to suggest a more descriptive error message (something linke "This form cannot be submitted from a preview link").
It took me quite some time to understand why the form is not working. And I do not see a obvious reason why the form should not be working in a preview link (not talking about live preview).
Yes, preview and live preview will do the same thing here. I'm looking into options for this, including an error message when submitting the form, checking for a preview request, but ideally I'd like to make this work in preview.
Thank you, would be great.
Describe the bug
We have a form that will throw an error:
Unable to parse response 'Syntax Error: Unexpected Token "<",...'
when we fill it out in a page that is a Craft CMS preview (URL only has the token parameter ?x-craft-preview=).Steps to reproduce
Unable to parse response 'Syntax Error: Unexpected Token "<",...'
Form settings
Craft CMS version
Craft Pro 4.11.5
Plugin version
2.1.28
Multi-site?
Yes
Additional context
No response