[ODK Community] ODK (xforms) required=true() OR?

One choice is to simply have a single field that asks for either your name
or your id, and not attempt to discriminate what it is.

The other choice is to define a form like the one attached that asks two
questions then has a 'confirmation' screen that checks that at least one of
the preceding questions has a value.

A very subtle pitfall in this last approach is that constraintexpressions are
not evaluated if the data value is empty.
So the computed value must never be empty. In this case,I get around that
by using concat() to prepend a space to the ra_id or ra_name (if ra_id is

If I hadn't concatenated a single space character to that string, then you
could pass through this question without entering any data into the ra_name
and ra_id fields.


eitherConstraint.xml (1.64 KB)

ยทยทยท On Tue, Sep 11, 2012 at 11:34 AM, wrote:

Hi all,

I couldn't find anything about this in the Xforms docs, but figured it
must be such a common data collection behaviour pattern that maybe ODK
somehow found a way around it...

I have two fields (say RA_NAME and RA_ID). I'd like to set the form up so
that the user must fill at least one of those fields. Basically, I'd like
to set a required binding that checks both fields and allows the user to
proceed if either of the fields is filled.

Hopefully I'm missing something really easy?

Thanks in advance,

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

Mitch Sundt
Software Engineer
University of Washington