Required column

Hi I just wanted to post a (at least for me) revelation that might help others.

In the required field, we used to have “true()” which is not a function in JS but mentioned in ODK docs, making questions mandatory BUT you could NOT deselect a radio button after choosing it.

Using just “true” allowed me to deselect options BUT did not make the question mandatory.

Using 1==1 that should evaluate to true, gives me “Could not evaluate, too many tokens”

Using ‘yes’ (also mentioned in ODK docs) also makes you able to deselect BUT not mandatory

But using the relevance of the same question in the required column also makes it to be required and also able to deselect.

Using 1 also allowed me to have a mandatory question AND being able to deselect.

Maybe it’s known, maybe not, but thought I should share :grin:


Thanks for the write-up here! This behavior is surprising (and frustrating). My understanding is that Enketo just treats the required value as an XPath and evaluates it to get a boolean value. I did not expect so much variability in the behavior of the unselect functionality of the radio buttons… :thinking:

It seems there is some history of challenges with unselecting required radios in Enketo and the CHT.

Which version of the CHT produced this behavior? It might be worth me doing some digging to see where things stand with newer versions of Enekto and if we need to un-hack some things here!

1 Like

Yes, very surprising for me too!
The CHT version that we are working on is 4.5.1.

1 Like