Validation and constraint

Hello Everyone
I have two questions in a form (group name and teachers name) when I select a specific group name, the specific teacher name should be appeared, not the others
please guide me how to do it
thank you

Could you please provide dummy questions with the possible choices and a brief explanation of what you wish to see so that the community would be able to better understand your issue and help you out with the same.

Hi @Kal_Lam
thank you for viewing my problem
here is the description
Q1: Group name
options are
Group A
Group B
Group C

Q2: Facilitators (teachers)
option are
Kalim and John
Ahmad and Sabir
Mateen and Sara

in this case when I would like to select Group A, only the option of Kalim and John appear
and if i select Group B, the option of Ahmad and Sabir should appear
and so on

One more query: so where would you like to show the facilitator’s name? Do you have Q3?

when selecting the Group A, in the next question the facilitators related to group A should be automatically selected or appeared, no the others

1 Like

You could do the same as outlined in the image below:

In the survey tab of your xlsform:
Image 1

In the choices tab of your xlsform:
Image 2

Data entry screen as seen in Enketo:

Reference xlsform:
Auto Select.xls (29.5 KB)

Note: You could also use the ready_only if you wish to have the response for Q2 locked as shown in the image below:

image

Reference xlsform:
Auto Select.xls (29.5 KB)

1 Like

@Kal_Lam
Thank you once again

1 Like

Hello @Abdul ,
Other solutions could be:

  1. Dynamically reduce the 2nd select to one item by using a cascade select. (Take care of empty in 1st question, if you set 2nd choice read_only),
  2. Add the names to the 1st Group choice label, like Group A (Kalim $ John)
  3. Show the related teacher pair just as a note (using a calculate variable)…

All options here (as the solution of Kal_lam) are based on a fixed 1 : 1 relation between Group and teacher pair. (For a n : m relation the solutions would be different.)

There is a small issue with the solution from @Kal_Lam. If the user selects a group and then deselects this (all) group. The 2nd choice will not get emptied. The form can be validated like this in Enketo Preview. But the situation will be cleaned on save or submit.
image

It might also be a bit confusing for the user/enumerator to show the full teacher list, but only allow one fixed selection.
Best regards

2 Likes

thank you @wroos

1 Like