formio.js
formio.js copied to clipboard
[BUG] Checking and unchecking the multiple option does not reset the defaultValue of a component
Environment
Please provide as many details as you can:
- Hosting type
- [ ] Form.io
- [x] Local deployment
- Version: 4.12 and 4.13
- Formio.js version: 4.13
- Frontend framework: React
- Browser: Chrome, Firefox
- Browser version: Chrome 103, Firefox 101
Steps to Reproduce
- Open the Formio builder https://formio.github.io/formio.js/app/builder
- Drag a textfield component into the form and save it
- Drag another textfield component into the form.
- Click on the data tab.
- Check 'Multiple Values'.
- Save the component.
- Click on the cog icon (edit) of the second text field.
- Click on the data tab.
- Uncheck 'Multiple Values'.
- Save the component.
- Scroll to where the form is rendered. In the first textfield enter the value 'test'
- Scroll to where the data is shown. Note that the second textfield is populated with an empty array.
Note:
This happens also for other component types, not only textfield
.
Expected behavior
The second textfield should have as defaultValue
an empty string, since the multiple
attribute is false
.
Observed behavior
The second textfield has as defaultValue
an empty array, even though the multiple
attribute is false
.
Example
Screen recording of the steps above: https://watch.screencastify.com/v/CedcUwKKm9mB1VNS6aRJ