-
Notifications
You must be signed in to change notification settings - Fork 23
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
Cannot submit form due to new backend validation #4068
Labels
bug
Something isn't working
needs-backport
Fix must be backported to stable release branch
owner: utrecht
Milestone
Comments
SilviaAmAm
added
bug
Something isn't working
triage
Issue needs to be validated. Remove this label if the issue considered valid.
labels
Mar 27, 2024
sergei-maertens
added
needs-backport
Fix must be backported to stable release branch
and removed
triage
Issue needs to be validated. Remove this label if the issue considered valid.
labels
Mar 27, 2024
SilviaAmAm
added a commit
that referenced
this issue
Mar 27, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
DRF date fields expect None to be used for empty values, but Formio datetime (and derived date/time) components send an empty string for an untouched/empty field. The date field subclass allows empty string as empty value too while shortcutting further validation.
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
These values are not properly normalized in the formio builder/renderer, so for now we must adapt our backend. This applies to all text-based components that support multiple.
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
Empty values can be sent both as 'null' or '[]', the latter seems to be what happens with Formio.
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
@SilviaAmAm with the linked PR I was able to complete the form after exporting it from our test env I can't reproduce this error bit: {
"name": "steps",
"code": "invalid",
"reason": "None"
} edit: just saw it with another form (description updated). I suspect this is present as soon as there are validation errors for a step, need to investigate further! |
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
Old bugs are still manifesting in new ways, layout components should not have a validate object, and definitely not with 'required' set to 'true', but here we are. Added a note to #4071 to keep track of this.
sergei-maertens
added a commit
that referenced
this issue
Mar 27, 2024
By using None as 'no errors' value, this gets serialized to the frontend as if there are errors for the 'steps' path. Using an empty dictionary excludes this from being serialized at all, because there are no nested errors at all. This manifests when there are validation errors for one step, but other steps don't have any validation errors, incorrectly reporting some sort of error about the steps that isn't actually there.
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
Checked with Silvia whether it can go or not.
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
…-form [#4068] Form with optional fields cannot be submitted
sergei-maertens
pushed a commit
that referenced
this issue
Mar 28, 2024
Backend validation was being applied more strict than equivalent in the frontend, which lead to submissions not being able to be completed. Fixes the following aspects: * Treat empty string is empty value for date field * Don't reject textfield (and derivatives) with multiple=True when items inside are null (treat them as empty value/string) * Allow empty lists for edit grid/repeating group when field is not required * Skip validation for layout components, they never get data * Ensure that empty string values for optional text fields are allowed (also covers derived fields) * Fixed validation error being returned that doesn't point to a particular component Backport-of: #4070
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
sergei-maertens
added a commit
that referenced
this issue
Mar 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
needs-backport
Fix must be backported to stable release branch
owner: utrecht
Product versie / Product version
2.6.0
Omschrijf het probleem / Describe the bug
Create a form with:
Try to submit: this shows that the call did not validate on the backend. The POST to
_complete
gives in theinvalidParams
:Stappen om te reproduceren / Steps to reproduce
See form with slug
analyse-design-shortcomings
on our test envAnother case that has issues, DH form "Beroep op vrijstelling schoolinschrijving"
Validation errors from complete call:
The text was updated successfully, but these errors were encountered: