Restrict number of choices in a multiple choice question based on a response from a previous question

How to restrict number of choices in a multiple choice questions according to number specified in a previous (number) question?

1 Like

Hi @Walibayk,

Welcome back to the community! Please see the discussion that has happened earlier in the forum which should solve your issue:

Have a great day!

Thanks a lot, I’ve already reviewed the discussion but it doesn’t really solve my problem. I have two questions, Q1 which say “how many?” and then Q2 which is a multiple choice question. I would like to limit the number of choices that the person can choose in Q2 to the number stated in Q.1. For instance, if the person answers “2” to Q.1 “How many?” then the person is limited to selecting only two choices in the Q.2 multiple choice question.

Hi @Walibayk,

Could you provide a dummy question so that we could have a look at it for these 2 questions (especially for your Q2).

Have a great day!

Here I provided Q.1 and Q.2Dummy Questions.xls (5.5 KB)

1 Like

Hi @Walibayk,

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

In the survey tab of your xlsform:

In the choices tab of your xlsform:
Image 2

Data Entry Template Seen in Enketo (Sample 1: Without an Error Message)

Data Entry Template Seen in Enketo (Sample 2: With an Error Message)

Reference xlsform:
Dummy Questions.xls (27 KB)

Have a great day!

1 Like

Thank you very much this is very helpful.

1 Like

To limit the number of responses to 3 in a multiple question:
You can also go to the question Settings and in Validation Criteria put the Validation Code:
count-selected (.) <= 3

2 Likes

Welcome to the community @fernanfojesus! Thank you for sharing your wonderful suggestion with the entire community (which should help out a lot of users). Expecting the same in the upcoming days as well. :clap: