Allow a response in a checkbox only if no other response is chosen

Hi,

I am setting up a checkbox question. One of the responses is “Don’t know”.
Is there any way to only allow this response if no other response is chosen?

Thanks,
Greg

Hi Greg,
One way is to use a validation phrase like this:

if(selected(., ‘dont_know’), count-selected(.) = ‘1’, count-selected(.) >=
‘1’)

It won't completely block them from selecting other responses in the

question but it will throw an error if they swipe forward and then you can
give an error message saying “If ‘Don’t Know’ is chosen, no other options
can be ticked” and they’ll need to un-check the others to go forward.

Best Regards,

Derek

··· On Wed, Mar 15, 2017 at 7:55 PM, Gregory Anderson wrote:

Hi,

I am setting up a checkbox question. One of the responses is “Don’t know”.
Is there any way to only allow this response if no other response is chosen?

Thanks,
Greg


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Derek Lane
Dimagi India | Field Manager
D - 1/28 Vasant Vihar | New Delhi 110057, India
m: +91 959 933 2445
www.dimagi.com

Hi Gregory,

Another way to do this is with the following expression:

not(selected(., ‘dont_know’) and count-selected(.) > 1)

This says: for this question, the user may not select both “don’t know” and
another option. As Derek mentioned, this will not prevent the user from
selecting other responses, but will prevent them from proceeding until they
correct their response.

For your validation message, you may want to say something like, “You may
not select ‘Don’t Know’ if any of the other statements are true. Please
correct your entry.” This way, the user understands immediately what
they’ve done incorrectly and how to fix it.

Hope this helps,
Alexandra

··· On Wed, Mar 15, 2017 at 11:05 AM, Derek Lane wrote:

Hi Greg,
One way is to use a validation phrase like this:

if(selected(., ‘dont_know’), count-selected(.) = ‘1’, count-selected(.) >=
‘1’)

It won't completely block them from selecting other responses in the

question but it will throw an error if they swipe forward and then you can
give an error message saying “If ‘Don’t Know’ is chosen, no other options
can be ticked” and they’ll need to un-check the others to go forward.

Best Regards,

Derek

On Wed, Mar 15, 2017 at 7:55 PM, Gregory Anderson <gregmanderson@gmail.com wrote:

Hi,

I am setting up a checkbox question. One of the responses is “Don’t
know”. Is there any way to only allow this response if no other response is
chosen?

Thanks,
Greg


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Derek Lane
Dimagi India | Field Manager
D - 1/28 Vasant Vihar | New Delhi 110057, India
m: +91 959 933 2445 <+91%2095993%2032445>
www.dimagi.com


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks! I used:

not(selected(., ‘dont_know’) and count-selected(.) > 1)

It worked perfectly.

··· On Wednesday, 15 March 2017 11:38:39 UTC-4, Alexandra Morgan-Kisarale wrote: > > Hi Gregory, > > Another way to do this is with the following expression: > > not(selected(., 'dont_know') and count-selected(.) > 1) > > This says: for this question, the user may not select both "don't know" > and another option. As Derek mentioned, this will not prevent the user from > selecting other responses, but will prevent them from proceeding until they > correct their response. > > For your validation message, you may want to say something like, "You may > not select 'Don't Know' if any of the other statements are true. Please > correct your entry." This way, the user understands immediately what > they've done incorrectly and how to fix it. > > Hope this helps, > Alexandra > > On Wed, Mar 15, 2017 at 11:05 AM, Derek Lane <dl...@dimagi.com > wrote: > >> Hi Greg, >> One way is to use a validation phrase like this: >> >> if(selected(., 'dont_know'), count-selected(.) = '1', count-selected(.) >> >= '1') >> >> It won't completely block them from selecting other responses in the >> question but it will throw an error if they swipe forward and then you can >> give an error message saying "If 'Don't Know' is chosen, no other options >> can be ticked" and they'll need to un-check the others to go forward. >> >> Best Regards, >> >> Derek >> >> On Wed, Mar 15, 2017 at 7:55 PM, Gregory Anderson <gregma...@gmail.com > wrote: >> >>> Hi, >>> >>> I am setting up a checkbox question. One of the responses is "Don't >>> know". Is there any way to only allow this response if no other response is >>> chosen? >>> >>> Thanks, >>> Greg >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "commcare-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to commcare-user...@googlegroups.com . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Derek Lane >> Dimagi India | Field Manager >> D - 1/28 Vasant Vihar | New Delhi 110057, India >> m: +91 959 933 2445 >> www.dimagi.com >> >> -- >> You received this message because you are subscribed to the Google Groups >> "commcare-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to commcare-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >