Can jr:choice-name be used for showing a choice different than the one selected?

I am looking for ways to explicitly mention unselected choices from previous questions in follow up questions using jr:choice-name.

Expected behaviour: In the following example, I would like Q2 to ask for the fruit not mentioned in Q1. If the respondent said apples in Q1, I want to see Q2 asking for oranges.

  1. Q1: select_one: Do you like apples or oranges?
  2. calculate1: if(Q1=“apples”, make that jr:choice-name shows “oranges”, make that jr:choice-name shows “apples”).
  3. Q2: text: Why did you not pick ${calculate1}.

This example is relevant for forms using several languages. Maybe there is a more straightforward solution I am not seeing?

Thanks in advance, and happy Friday!

Welcome to the community, @eduardoag! Why would you try that approach when we already have another approach that has been discussed in the community previously:

Hi, thanks for the swift response. Regrettably, this does not solve my problem. Sorry, it might have been that the question’s title is misleading. As you see in the provided example, I would like the question text, not the response option, to change dynamically depending on previous answers. The response options are the same in my form, but the questions vary depending on the first response.

@eduardoag, maybe you could do it as outlined in the image shared below:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Image 2

Data entry screen as seen in Enketo: when nothing is entered in Q1

Data entry screen as seen in Enketo: when the first choice is entered in Q1

Data entry screen as seen in Enketo: when the second choice is entered in Q1

Reference XLSForm:

If Statement.xlsx (11.2 KB)

1 Like

Hi Kal_Lam, thanks for the approach, sounds good.

1 Like