Survey123 Connect - constraint question

1632
2
04-06-2023 10:26 AM
doronwen
New Contributor II

Hello,

I'd like to apply a constraint to a question in my survey. The constraint will insure that the number users enter in question B will be smaller or equal to the value users enter in question A.

Example: User enter the number 12 in question A, and then the user try to enter number 13 in question B. That should result in a message saying "Value in question B cannot be larger than the value in question A"

I added the following formula in my XMLForm file under the 'constraint' column for question B:

.<=${question_A}

But that does not work (the form allows me to enter a larger number in question B). Any suggestions?

Thanks!

0 Kudos
2 Replies
BarbaraWebster1
Esri Regular Contributor

Hi @doronwen,

The constraint expression you provided looks like it's set up correctly. Do you see the constraint message if you try to submit the survey? Constraints are evaluated on survey submission rather than when the value is entered into the question.

Thanks,
-Barbara

DougBrowning
MVP Esteemed Contributor

Sometimes when you use the dot and < and = together it thinks its HTML and breaks.  Write out the field name instead of using . and see if that fixes it.

0 Kudos