Closed mauritsvanrees closed 5 months ago
i think it's not relateed to that pr. We are using latest versions of volto-form-block and collective.volto.formSupport with some customizations but not on that specific part where error comes up.
Could you make some debug end eventually make a pr ?
I have a PR with a fix.
Just for the record: I had the problem on Volto 18 with volto-light-theme, but I tried in a fresh Volto 17 project and this had the same problem that the form could not be submitted.
For me this PR did not fix this issue (tested with vanilla Volto 17.15.5 & Plone 6.0.9).
formState.result
is now an array which is still not a valid React child, so this line <p>{formState.result}</p>
in FormResult.jsx
(see) is still throwing the same error.
Furthermore if data.send_message
is set, this line is also throwing an error, since it does not expect formState.result
to be an array.
PR with fix: https://github.com/collective/volto-form-block/pull/101
@mauritsvanrees @mbarde that PR doesn't fixes the problem and introduces another error.
i've revrted your pr.
formState.result is a state var that is created with received backend response that should be like this.
{ "data": [ { "field_id": "1715689298710", "label": "Testo lungo", "value": "klkl" } ] }
if you don't obtain that response from server, maybe you have to check your Plone addons installed and their versions, or if you have something in the middle that changes the response format.
@giuliaghisini Thank you! Yes, the response looks exactly as you describe. But still at this line formState.result
is an object like that:
{
"data": [...],
"message": "Form successfully submitted",
}
which can not be rendered like that: <p>{formState.result}</p>
.
In my opinion the fix should be: <p>{formState.result.message}</p>
@mbarde your're right! colud you make a pr for this please?
@giuliaghisini PR: https://github.com/collective/volto-form-block/pull/103
I see the same, an Object with a message and data. Copied from console:
Object { message: "Form successfully submitted", data: (1) […] }
data: Array [ {…} ]
0: Object { field_id: "1718372796037", label: "Who?", value: "dsfdgdfs" }
length: 1
<prototype>: Array []
message: "Form successfully submitted"
```
Sorry for the mess. Somehow my PR fixed it for me, and I was surprised that it worked for you without it. I fixed it as best I could, but my frontend dev and debug skills need work. :-)
I have a Plone 6.0 site with Volto 18, volto-light-theme, and
collective.volto.formsupport
(tried 2.7.0 and 3.0.2).volto-form-block
3.7.3 works fine. But when using latestvolto-form-block
3.8.2 (or 3.7.4 or 3.7.5) I get this error when submitting a form:Since this error first appears for me in 3.7.4, it should be related to PR #94 by @giuliaghisini . Any idea?