Date Constraint for XForms in Open Data Kit

Had some trouble Googling this little nugget, so I thought I might share it here.

If you want to constrain a date field in Open Data Kit by a specific date (i.e. “The date must be before 12/15/2000”), here’s the syntax:

<bind nodeset="/demographics/dob"
      type="date"
      constraint=". &lt; date('2000-12-15')"
      jr:constraintMsg="Date of Birth must be before 12/15/2000"
      />

Don’t forget the quotes inside the parentheses.

One thought on “Date Constraint for XForms in Open Data Kit

Leave a Reply

Your email address will not be published.

*
= 4 + 4