formio / formio.js

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

FIO-8438: fix datagrid addrow clearing checkbox #5643

Closed ZenMasterJacob20011 closed 1 week ago

ZenMasterJacob20011 commented 3 weeks ago

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8438

Description

What changed?

Previously, formio.js would clear radio components with the option inputType: checkbox when a new row was added to the datagrid. This PR replaces this behavior by retaining the state of the checkbox when data grid adds a new row

Why have you chosen this solution?

Although there were many potential solutions, my solution was best because it adds a check to see if the element property on the component has the property checked to true to verify that the component is checked. It also does not remove value[input.value] to allow for reverse compatibility.

Dependencies

N/A

How has this PR been tested?

I added automated tests to cover checkbox when checked and checkbox when unchecked cases. I also verified that removing my change from this PR will break these tests to validate that my tests are working as intended.

Checklist: