Skip to content

FIO-9974 fixed Clear on Hide for layout components #6112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

HannaKurban
Copy link
Contributor

@HannaKurban HannaKurban commented Apr 30, 2025

Link to Jira Ticket

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

Description

According to the documentation, for Layout components, such as Panels, Well, Fieldset, etc the default value of clearOnHide is set to false. That is, when hiding the parent Layout component , the value of the child components should not be cleared (see Example Scenarios 3). But the value of the clearOnHide property can be manually overwritten to true using the Layout component's JSON schema. Several issues related to this functionality have been found and fixed:

  • For the FieldSet component, the default value of clearOnHide property was set to true. This means that when hiding the FieldSet component, all the values of the child components were always cleared, regardless of whether clearOnHide property was set in the JSON schema or not, contrary to the documentation. This was fixed by adding clearOnHide property as false for the FieldSet component a default value.
  • Manually overwriting the value of the clearOnHide property as true did not change the behavior of the Layout components. That is, even if the User manually set the clearOnHide property to true in the Layout component's JSON schema, the values of the child components were not cleared, contrary to the documentation. This was due to the fact that Layout components, such as Panels, Well, Fieldset, etc do not have their own values, therefore, in the deleteValue method, the values of child components were ignored and not cleared, even when setting clearOnHide as true in the JSON schema of the Layout component . This was fixed by adding a check for Layout components and clearOnHide property.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Added automatic tests covering the behavior of the clearOnHide functionality for the Layout component for both cases: default behavior and manual overwriting of the clearOnHide property as true. All tests pass locally

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@HannaKurban HannaKurban requested a review from travist June 16, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant