Hiding a field with field rules does not unset the value

Hi Sebastian,

Me again :slight_smile:

I found a bug in conditional fields.

First, I created 3 schemas to create conditional fields.

I have defined some conditions.

then I come to the data entry screen.

I selected Section 1 and select test field content.

then I realize that I should actually choose Section 2 and fix it.

When I save this content, it saves the data of 2 fields.

Actually, I only expect it to save the test2 field data for Section 2.
This causes problems in systems that produce outputs such as reports etc.

Thank you.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [X] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Expected behavior

Minimal reproduction of the problem

Environment

  • [ ] Self hosted with docker
  • [X] Self hosted with IIS
  • [ ] Self hosted with other version
  • [X] Cloud version

Version: [5x]

Browser:

  • [X] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

This is by design so far, it does not change the value.

Oww ok. But when I selected Section 2 and saved it, I was expecting the data I chose for section 1 to be null. Can we put an option for it or edit it like this?

Of course we can have a discussion whether it makes sense or not, but it is a pure UI feature. It does not protect your data in any way and even if we would solve it in the UI it would not be a “save” option.

To achieve this, a query can be written in the Schema Scripts area for Create or Update. Maybe in the Query step … Is it a solution at some point if both fields keep their data? Or is this an unnecessary process? I could not fully decide on this. but I have coded a report application and it causes confusion when exporting excel.

As a workaround this should work for you, but I understand that your requirement makes sense.

will you make an improvement to automatically unset data?

Perhaps as separate action. Or I am waiting for a PR :wink: