How do i restrict multiple choice response to only 3 answers?

How do i restrict multiple choice response to only 3 answers?

There actually an example of precisely this here: Form Operators and Functions - ODK Docs

Basically, you just need to use the count-selected() function in a constraint. If you require exactly three responses then use ‘=’ in the constraint; if you want a maximum of three then use ‘<=’ instead.

2 Likes

Hi everyone - very helpful thread! And, a follow up: I struggle to find the actual “Count-Selected () function” where I can insert <= … where is it? Is this function available in the free global version of Kobo? Fingers crossed :slight_smile: Grateful for some guidance on how to figure it out.

count-selected() ; use it on CONSTRAINT column, if you want to restrict someting;
Other wise it can be use for other purposes like relevance, repeat-count etc.

count-selected() - count the number of choise which have been selected on a multiple select question.

1 Like

Thanks! And hope you dont mind me asking for some additional clarification. Where exactly can I find this function? I’ll paste a screen shot of how the settings look when I open the settings for the multiple choice. I am using the free global version and start to think that this function is not available there? Thanks a lot! :slight_smile:

on Validation Criteria.
Now your screenshot tells a lot.

My Reccomendation: 1. Do not create XLSX on builder. I would suggest you use Excel to build your forms. It is fast , easy , efficient. This will help you build complex forms with hassle.
I dont mean the online builder is not good but using EXCEL will make things a bit easier

You can download a well organize template here:: https://github.com/getodk/xlsform-template/raw/main/ODK%20XLSForm%20Template.xlsx

2 Likes

The Kobo Formbuilder UI only presents a subset of the available functionality; this is also true for Formbuilder validation. However, you can still manually add whatever validation rules you like, you just need to know how to write the necessary constraint condition.

To validate only a maximum number of options are selected using just the Formbuilder try the following:

You must enter these ‘manual’ validation rules under here:

This functionality is available on all Kobo servers: global, EU, private or otherwise.

3 Likes