open-formulieren / open-forms

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

Hidden components with "Multiple values" trigger validation #4659

Open LaurensBurger opened 1 week ago

LaurensBurger commented 1 week ago

Product versie / Product version

latest

Customer reference

no particular but it get's reported

Omschrijf het probleem / Describe the bug

Hidden component with "Multiple values" set get their defaultValue changed from:

  "defaultValue": null,

to:

  "defaultValue": [
    null
  ],

This causes validation to trigger right after loading since their value is now [] instead of [ null ]

  "telefoonnummer": []

This can be resolved by changing the defaultValue to via the json of the components:

  "defaultValue": [],
joeribekker commented 6 days ago

Refinement: Task estimated here is changing the default value to an array ([]) without the null.

Robin can do this in an hour. So, let's timebox this to 2 hours. After that, the proper estimate is: (whatever Robin thinks)

robinmolen commented 3 days ago

I cannot reproduce this issue. I've followed these steps:

robinmolen commented 3 days ago

I've made a PR that ensures that textfields always have a valid value (so null will be turned into '').

When a textfield (with the default value null) gets the multiple values property, the default value will change to [''].