-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Error when submitted in a Craft Preview #2082
Comments
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
The text was updated successfully, but these errors were encountered: