formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.89k stars 1.06k forks source link

Data grid: deleting rows with HTML 5 select lists mangles the data #5390

Open WalterMoar opened 1 year ago

WalterMoar commented 1 year ago

Using v4.17.2 I've isolated this down to the simple case of:

  1. Data Grid
  2. One column in the data grid containing a Select component
  3. The Widget Type of the select list is HTML 5
  4. The "Data" for the select is One (value "one") and Two (value "two")

In this type of form, the following error happens:

  1. Choose "One" for the first select
  2. Add another row
  3. Choose "Two" for the second select
  4. Delete the first row ("One")

Expected: one row with the value Two. Actual: one row with the value One.

Workaround 1: Use ChoicesJS. Not an option because of #5229 Workaround 2: Use numeric values (1, 2) instead of strings (one, two). Not an option because it reduces the "readability" of the data.

Note: our real-world form actually has the problem that when a row is deleted then some of that row's data is merged into the data from the following row - but above is the simplest case.

daneformio commented 7 months ago

Thank you for reporting this issue. I am able to reproduce and have logged a ticket for the backlog. We are always willing to review any contributions to resolve this issue from the open source community.

For internal reference: https://formio.atlassian.net/browse/FIO-7946