open-formulieren / open-forms

Smart and dynamic forms
https://open-forms.readthedocs.io
Other
37 stars 26 forks source link

Case of select boxes values changed when step is never applicable during submission #4810

Closed LaurensBurger closed 1 day ago

LaurensBurger commented 2 weeks ago

Product versie / Product version

2..8.1

Customer reference

DH

Omschrijf het probleem / Describe the bug

When a step is non-applicable from the start of the form and never made applicable, the select box component in this step (mapped with objecttype v2) submits values that are different from what can be seen in the form builder: image image

This does not occur when the step is applicable. One submission with 2 identical components in different steps can produce this result:

                "stap-uno": {
                    "ditZijnCheckboxes": {
                        "HOOFDLETTERS": true,
                        "IS_IN_HOOFDLETTERS": true,
                        "JAWEL_SCREAMING_SNAKES": false
                    }
                },
                "stap-dos": {
                    "ditZijnCheckboxes1": {
                        "hoofdletters": false,
                        "is_in_hoofdletters": false,
                        "jawel_screaming_snakes": false
                    }
                }

Which causes issues with jsonschema validation.

robinmolen commented 2 days ago

Update: this happens because of the initial_value of the component form variable.

When submitting the form, a check is performed to make sure that all variables are present. (As i understand, to make sure that systems cannot break because of missing data). So when the component should be created, the data is collected from the initial_value of the form variable. For some reason this is (always) lowercase, resulting in lowercase data in the submission.