Validation Criteria Code

Hi All, I have a select_multiple question that I need to add two validation criteria to the question, where I need to prevent selecting two options when one of the below options ( NA or I am not prepared) is selected. Please see the below example to understand my request:

The question is:

  • How were you prepared?

The options are:

  1. Awareness Session ----- choice name b3_1
  2. Training ----- choice name b3_2
  3. Practices ----- choice name b3_3
  4. Other ----- choice name b3_4
  5. I am not prepared ----- choice name b3_5
  6. NA ----- choice name b3_6

What I need is that when the enumerator selects ( NA or I am not prepared) he will not be able to select any other question. I have used this code ( if(selected(., ‘b3_5’), count-selected(.)=1, count-selected(.)>=1) ) to apply the validation for one of the choices. but how can I write a code to apply for the two choices. Please if you can help me, I would be much appreciated. Thanks in advance!!

just add the second case:
if( selected(., ‘b3_5’), or selected(., ‘b_3_6’), count-selected(.) = 1, count-selected(.) >= 1 ).

Additionally: You might use true() for the else case (and required = true, if answer is mandatory).

Using the search function of the forum might offen help you too: For ex.

Dear @wroos, Thanks a lot for the quick response and the great help you provided. The code you provided worked very well, but it just needs parentheses for the first parameter of the if statement.
if( (selected(., ‘b3_5’) or selected(., ‘b3_6’)), count-selected(.) = 1, count-selected(.) >= 1 ). Thanks again for your support.

Hello @Kal_Lam,
Would you mind to have a look at this, please.
I think, brackets should not be needed for a simple or combination. Maybe this is a hint on a current parser problem?
Thanks in advance anx kind regards.

@Marwan, we have a perfect example discussed previously that should solve your issue cc @wroos: