Survey123 Web App ignores some constraint messages from Connect form

221
1
08-14-2024 10:40 AM
NatashaMiller
New Contributor

I am creating a survey in Connect to be displayed in English and 7 other languages in the web app. Two of the languages--Khmer and Tagalog--are not Survey123 supported languages, so I have several columns of unique text for each language on every row. We've done this before in other surveys and had no trouble, but a specific row has strange behavior for the "constraint" and "constraint-messages" columns. Under certain conditions, my constraint messages are overridden by default messages in the web app. What am I doing wrong here?

Desired output: Ideally, this would be what the user sees when they enter any number of characters past 200. Here is the result that comes from row 4 of the attached sheet in English, Spanish, and Khmer when 201-254 characters are entered in the text box:

NatashaMiller_2-1723654397430.png

I originally wanted to limit this text field to its field length of 255 characters. If I do not add a constraint or constraint message and the user goes over 255 characters, the default error message pops up: "Answer must be at most 255 characters." This message is translated automatically between the supported languages, but otherwise it is in the survey's default language (English in my case).

I created a constraint "string-length(.)<=255" with a custom constraint message in each language (see row 2 of attached sheet). Instead of displaying my custom constraint value, the web app now displayed the default message 9 times--once for each "constraint_message" language column. Here's that result in English, Spanish, and Khmer: 

NatashaMiller_3-1723654663141.png

Through trial and error, I found some workarounds. The 8 duplicate messages are removed by constraining to a "less than" statement instead of "less than or equal to" (line 3 of attached sheet), but the default message still overrode my values. 

I have only been able to get around this by lowering the constraint maximum below the field length. The default message still overrides my custom messages if the user surpasses the field length, so I have set the constraint to "string-length(.)<201". A user input between 200 and 255 characters gets my constraint_message value, which gives some buffer time where they can see the message in their language before they type so much that the default overrides it again.

Side note... These issues do not occur with a numeric field I have in the same survey which has the constraint "regex(., '^\d{5}$')".

0 Kudos
1 Reply
NatashaMiller
New Contributor
 
0 Kudos