In the UI enableWhen logic doesn't depend on the order of questionnaireItem because of its reactive nature.
The removeDisabledAnswers function is called once before questionnaire save. It process questionnaireItem one by one that causes the issues when value for enableWhen attribute is defined after.
It happened when hidden populated fields with constants used to adjust form behaviour.
Since that are not visible, a form designed may place them anywhere in the Quesitonnaire either top or bottom.
Check tests for more details:
beda-software/sdc-ide@28a01f1
https://github.com/beda-software/sdc-ide/actions/runs/13321717229/job/37207479535
As a workaround we can reorder questionnaireItem to move handle hidden items first.
However the issue still be present if non hidden items.
In the UI enableWhen logic doesn't depend on the order of questionnaireItem because of its reactive nature.
The removeDisabledAnswers function is called once before questionnaire save. It process questionnaireItem one by one that causes the issues when value for enableWhen attribute is defined after.
It happened when hidden populated fields with constants used to adjust form behaviour.
Since that are not visible, a form designed may place them anywhere in the Quesitonnaire either top or bottom.
Check tests for more details:
beda-software/sdc-ide@28a01f1
https://github.com/beda-software/sdc-ide/actions/runs/13321717229/job/37207479535
As a workaround we can reorder questionnaireItem to move handle hidden items first.
However the issue still be present if non hidden items.