A `select-contact` question displays blank when the containing group is conditionally shown in an app form

Create a question with the following properties

  1. type of string
  2. appearance of ``select-contact`
  3. calculate of ${some_previously_selected_id}

Place this question within a group, for instance hh_respondent_info, and have the group’s relevant field contain some conditional (in our case the section was hidden by default).

When showing the section later, the question will display blank while containing a legitimate value.
This can be seen in the below screenshots:

When the relevant value is present in the containing group:

When the relevant value is removed from the containing group:

Please note the Selected id field at the bottom shows the value that’s present in the Please choose a household respondent question.

The xlsx file used for this test can be found here.

This behavior also seems to be a bug in the select-contact functionality (specifically related to the handling of pre-populated values). I have logged db-object-widget not re-triggered when field becomes relevant · Issue #8653 · medic/cht-core · GitHub

In the cases were you are loading a pre-populated contact value that should not be editable by the user, I think the recommended approach for now would be to just do that in a group that is always relevant (but then maybe display the data and related questions in a different group that can start as non-relevant).

1 Like