Description of the limitation and why it is relevant to address
As a VIKTOR app developer, I would like the fields that are not visible to be empty or reset, so that other fields are not influenced by invisible fields.
I think this is relevant for the VIKTOR platform because it will decrease the number of statements needed in visible
, increase the readability of the code and avoid unwanted visibility of fields.
Example which shows the problem:
I have field_1 (What do you want on your bread?) with options Cheese and Peanut butter.
I have field_2 (What kind of Cheese do you want?) with options Gouda or Beemster, and I only want to show this if field_1 == Cheese.
Then I have field_3 (Do you want 30+ or 48+ Gouda Cheese), and I only want to show this if field_2 == Gouda.
The problem is, when in a previous attempt in the same session, field_2 is set to Gouda, but field_1 is now equal to Peanut butter (which makes field_2 invisible), it will still show field_3 even though it is not logical to show this. This can be solved by using both statements, but this can become quite messy.
Submitter proposed design (optional)
I would suggest making the field empty/reset the field when it becomes invisible.
Current workarounds
Use multiple statements, which can become quite a mess.
For the example (if field_3 is a NumberField):
field_3 = NumberField('field_3', visible = And(IsEqual(Lookup('field_1'), 'Cheese'), IsEqual(Lookup('field_2'), 'Gouda')))
In this case it only includes two statements, but I already have some cases where I use 4 or 5.