Community Health Toolkit

How to list multiple constraint messages on a single field in XLSForm

I have two date fields in my xlsform. I would like to show an error message when the user leaves either of the date fields blank or when the user enters a date in the second date field which is less than the date entered in the first date field.

How can I construct my contraint and contraint message columns?

1 Like

One constraint expression can only have one constraint message. It should be possible to have separate note fields below the nodes of interest that are made relevant based on a subset of the original compound expression.

You could try:

Date 1: not empty
Date 2: not empty and >= Date1

You can have your constraint expressions remain as is and leave the constraint message empty (for the date fields).

Note 1: Show if either Date 1 or Date 2 is empty
Note 2: Show if Date 2 < Date 1

You could style the note texts and have them appear in red and bold.

1 Like