Restrict selecting none and other choices

Hi am trying to make a form that restricts selecting None and other choices or selecting All of the above and other choices.

Which fruits do you eat?
None
All of the above
Mango
Orange
Pawpaw

Can some one help me on this?

Hi @stobira,

Please check the related question ODK survey if conditional on a multiple response question - #6, there are couple of sample forms where constraint column is used to restrict what can be selected in select_multiple question type

Here is a working example: example_constraint_none_and_all_selections.xlsx (9.8 KB)

You'll want to use a constraint to limit the acceptable answers. Be sure to include a constraint_message that will tell the user why their answer is not being accepted!

The below means... do not allow the answer if the user selects "none" with more than 1 option selected. The . means "this question", the 'none' is the name value for the "None" answer in the choices list, and count-selected(.) returns the number of answers the user has selected in this question.

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

You can then combine it with a statement about selecting the 'all' answer. The combined constraint is in the example file.

1 Like