Checkboxes

hi all,

i have a field with 8 checkboxes...the first is "none", second is "HIV",
third is "Cancer", and so on..i would want "none" to be selected if
none of the other 7 are selected; the other 7 can be selected together BUT
NOT with the "none" option. Either* *the *"none" option is by its
self, or the others can be selected together if not one of them.
*The
following *constraint *code works for just two options but not more:

WORKING CODE: * not(selected(., 'None') and selected(., 'HIV'))*

CODE NOT WORKING: not(selected(., 'None') and selected(., 'HIV') and
selected(., 'Cancer') and ......)

Please help.

Thank you in advance

you have a bug in your code. should be: none and (hiv or cancer or etc)

··· On Thu, Dec 22, 2011 at 02:08, Thapelo Khumomotse wrote: > hi all, > > i have a field with 8 checkboxes...the first is "none", second is "HIV", > third is "Cancer", and so on..i would want "none" to be selected if none of > the other 7 are selected; the other 7 can be selected together BUT NOT with > the "none" option. Either the "none" option is by its self, or the others > can be selected together if not one of them. The following constraint code > works for just two options but not more: > > WORKING CODE: not(selected(., 'None') and selected(., 'HIV')) > > CODE NOT WORKING: not(selected(., 'None') and selected(., 'HIV') and > selected(., 'Cancer') and ......) > > Please help. > > Thank you in advance

You should be able to do the following so as to not have to type out every
node each time, too:
not(selected(., 'None') and count-selected(.) > 1)

more info at: http://opendatakit.org/help/form-design/binding/

··· On Thu, Dec 22, 2011 at 8:40 AM, Yaw Anokwa wrote:

you have a bug in your code. should be: none and (hiv or cancer or etc)

On Thu, Dec 22, 2011 at 02:08, Thapelo Khumomotse thapelo.khumomotse@gmail.com wrote:

hi all,

i have a field with 8 checkboxes...the first is "none", second is "HIV",
third is "Cancer", and so on..i would want "none" to be selected if none
of
the other 7 are selected; the other 7 can be selected together BUT NOT
with
the "none" option. Either the "none" option is by its self, or the others
can be selected together if not one of them. The following constraint
code
works for just two options but not more:

WORKING CODE: not(selected(., 'None') and selected(., 'HIV'))

CODE NOT WORKING: not(selected(., 'None') and selected(., 'HIV') and
selected(., 'Cancer') and ......)

Please help.

Thank you in advance