← Back to team overview

dhis2-devs team mailing list archive

Validation Rule for Yes Only Tick boxes

 

Hello Developers,

This is a different question, but tangentially related to my forthcoming
question about Option Sets:

*How does one make a validation rule using the yes/only tick boxes? *

(The following examples are pretty rudimentary, I've created a blank 2.20
instance just for testing this logic out) While my example might be a good
case for the tracker (which has radio buttons for Option Sets), this will
be all part of a much larger aggregate data entry form.

It seems that analytics interpret a ☑ as a "1" in 2.18 (2.20 the jury is
still out), which makes doing things like pivot table very straight
forward. When I applied that logic to the validation rules I have come up
empty.

So I have three optionCombos for a data element:
[image: Inline image 1]

I'd like to prevent the user from checking more than one box. *The ideal
thing would be to make a radio button, but the users don't have the
time/expertise to set up and maintain a custom form, so I am left with
validation rules. *

So I made a validation rule where the Left side:
[image: Inline image 3]
and the right side is "1"
[image: Inline image 4]
and the operator was ==

I tried many variations of operator, and have even put in things that can
never be true, and in every case I cannot get the validation step to come
back with anything but passed:[image: Inline image 2]

Am I missing any kind of gotcha or proper syntax for checking "Yes Only"
values? The only other thing I can think of is to have the user input a "1"
into a number entry and check that with a validation rule.

I checked what this looked like in the DB, and they are coded as "true"
just like a Yes/No:
[image: Inline image 5]

I tried various combinations of "Yes" "yes" "true" "TRUE" and couldn't get
any to take.

Any help on this would be greatly appreciated. Thanks!



*Timothy Harding*
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | tharding@xxxxxxxxxxxxxx | http://www.baosystems.com | Skype:
hardingt@xxxxxxxxx | 2900 K Street, Suite 404, Washington D.C. 20007

PNG image

PNG image

PNG image

PNG image

PNG image

PNG image


Follow ups