Description
In ArcGIS Survey123, constraint messages are not displayed instantly when respondents input responses that do not meet the specified constraints. For text questions with character limit constraints, no messages are displayed when the limit is exceeded; instead, the input is truncated.
Cause
- By design, ArcGIS Survey123 displays constraint messages only after the survey is submitted, as the constraint validation occurs after submission.
- By design, the default field length precedes any specified maximum length constraint. The default field length, displayed as the character count below the question text box, truncates the input when the characters exceed the limit instead of returning any message. The question text box below displays the character count of 255.
Solution or Workaround
Use hint
A survey with multiple invalid responses displays the constraint message only for the first non-compliant question, leaving the other invalid responses unflagged. Respondents must resubmit the survey repeatedly to view the constraint message for subsequent questions.
To work around this, configure hints for the question to inform survey respondents on the answer criteria.
- In ArcGIS Survey123 Connect, open the survey's XLSForm.
- For the question with the constraint, in the hint column, specify the answer criteria.
- Press Ctrl + S to save the XLSForm.
Note:
Optionally, configure a placeholder text to display hints in the question text box. Refer to How To: Add placeholder text for text questions in ArcGIS Survey123 Connect for instructions.
Increase the string value for the text question
In ArcGIS Survey123 Connect, the default character limit for a text question type is 255 characters. Increase the value to allow input exceeding the character limit specified by the constraint. Follow the steps below to display the constraint message when the input exceeds the configured character limit.
- In ArcGIS Survey123 Connect, open the survey's XLSForm.
- In the Survey worksheet, in the type column, select text from the drop-down menu.
- In the name column, specify the question name. In this example, the name is ‘remark’.
- In the label column, specify the question label. In this example, the label is ‘Remarks’.
- In the constraint column, specify an expression to constrain the number of input characters. In this example, the expression 'string-length(.)>99 and string-length(.)<=500' is specified to constrain the input to a range between 100 and 500 characters.
- In the constraint_message column, specify the constraint message. In this example, the message is 'Ensure the remarks are between 100 and 500 characters only!'.
- In the bind::esri:fieldLength column, specify a value larger than the maximum character constraint specified in Step 5. In this example, the value is '550'.
- Press Ctrl + S to save the XLSForm.