How to block the other alternatives when choosing a specific one in select_multiple?

Hi,

I'm trying on a select_multiple list, select only one alternative and block the others if it is selected and if I don't, check all the others at the same time.
How to block the other alternatives when choosing a specific one in select_multiple?
Ex: 1, 2, 3, 4, 5
I need to select number 1 and lock for selection 2,3,4,5 as soon as 1 is selected. But if I don't select number 1, I can check any other alternative at the same time (2,3,4,5).

Thanks in advance.

Hello Barbaramt,

You can use this ((. = '1') or not(selected(.,'1'))) in constraint column.

Hope it works for you. Do tell if its works or not. I had used it and its works for me.

Regards,
Dinesh Dongol

Thanks for the return!

I tried that way but the other selections were blocked. I would like to select number 1 and block the others BUT if I do not select 1, all the others can be selected without blocking. If you select 1, block all others and if you do not select, you can select all others.

Hi, this is a common case, the below example should solve it for you. If the question "select all the colours you like?" (red, blue, yellow, none) this will allow any combinations that don't include "none" and of course "none" can be selected if its the only option.

not(selected(.,'none') and count-selected(.)>1)

Taking advantage of the question... is it possible to change the error message of the calculation that appears after selecting the other alternatives?

For sure. https://xlsform.org/en/#constraint-message
Or if you modify in KOBO formbuilder its the box underneath validation criteria one.

As I imagine your using excel, the only thing to make sure is that if you have multiple languages and have multiple columns for labels, hints etc., you need to do the same for constraint_messages (constraint_messages::eng, constraint_messages::ar, constraint_messages::fr). If its only one language in the form then you can ignore this paragraph.

2 Likes

Solved! Thanks for your help and patience!