show if, enable if cannot access variables from preliminary questions?
Hello to all,
I have come across a strange behavior with field conditions in version 1.3.5 and hope someone can help me. I would expect that with the following code, the two fields are editable as soon as I select "Show field on page 2" in the first question. But the selection doesn't matter, only the "field 2" is always shown activated.
---
mandatory: True
code: |
page1
page2
---
question: |
Show Uploads?
fields:
- Show field on page 2?: is_show
datatype: yesno
continue button field: page1
---
question: |
is_show: ${ is_show }
fields:
- Field 1: field_1
show if: is_show
- Field 2: field_2
enable if: is_show
continue button field: page2
---
A workaround is to include the is_show field on question page 2 as well, then the behavior is as expected, but I don't really want that.
Regards
Thomas
I am running into a similar issue. I will try to show my code in a bit.
See https://docassemble.org/docs/fields.html#show%20if and use the code variant of show if if you want to refer to an already-defined Python variable rather than a field in the front end.
I almost missed the answer. Thank you very much.