HOW TO

Restrict the entry of specific text values in ArcGIS Survey123 Connect

Last Published: April 5, 2023

Summary

In ArcGIS Survey123 Connect, a text question allows submitters to provide free text responses. It is sometimes necessary to restrict the use of certain words or characters in the text question for better data collection.

This article provides two workflows to restrict the entry of specific text values in ArcGIS Survey123 Connect.

Procedure

Depending on the suitability, use one of the following workflows to restrict the entry of specific text values in ArcGIS Survey123 Connect.

Use the regex() function

In this example, the regex() function is used to restrict the entry of commas for a text question in ArcGIS Survey123 Connect.

  1. In ArcGIS Survey123 Connect, open the survey's XLSForm.
  2. In the survey worksheet, in the constraint column of the text question, specify the expression using the regex() function to restrict the entry of specific text values.
not(regex(., "<text_value>"))
  1. In the survey worksheet, in the constraint_message column of the text question, specify a message to be displayed when the restricted text values are entered. In this example, the message ‘There is a comma value!’ is used.
Text question configured with constraint and constraint message
  1. Save the XLSForm file.

The image below displays the constraint message when a comma value is entered in the text question in ArcGIS Survey123 Connect.

Message restricting the use of comma in the text question in ArcGIS Survey123 Connect

Use the pulldata() function

In this example, a CSV file containing the list of restricted words for the text question is added to the survey and the pulldata() function is used to restrict the entry of these words in the text question.

  1. In ArcGIS Survey123 Connect, open the survey's XLSForm.
  2. Create a text and hidden question.
    1. In the survey worksheet, in the type column, select text. Specify the values in the name and label columns as desired. In this example, the question is named ‘opinion' and labeled 'What is your opinion on deforestation?'
    2. In the survey worksheet, in the type column, select hidden. Specify the values in the name and label columns as desired. In this example, the question is named ‘pulldata_opinion' and labeled 'Check if the word is allowed'.
  3. Configure the text question using the pulldata() function.
    1. In the survey worksheet, in the constraint column, specify the expression using the pulldata() function to restrict the entry of specific text values.
.!=${<hidden_fieldname>}
  1. In the survey worksheet, in the constraint_message column of the text question, specify a message to be displayed when restricted text values are entered. The message ‘Word not allowed’ is used in this example.
Text question with constraint and constraint message
  1. Attach the CSV file containing the list of restricted words for the text question. Refer to ArcGIS Survey123: Retrieve a value from CSV for instructions. In this example, a CSV file titled ‘restricted_words’ is used.
  2. Configure the hidden question. In the survey worksheet, in the calculation column, specify the expression to check if the text values entered in the text question are allowed.
pulldata('<CSV_name>', '<csv_header2>', '<csv_header1>', ${<text_fieldname>})
Hidden question with calculation
  1. Save the XLSForm file.
The images below display the constraint message when the restricted words from the CSV file are entered in the text question of the survey.
The constraint message displayed when the word none is entered in the text question of the survey
The constraint message displayed when the word Not Sure is entered in the text question of the survey

Article ID:000029983

Software:
  • ArcGIS Survey123 Connect

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options