Text and numbers

You can include text, integer, and decimal questions in surveys for users to type text and numeric answers.

Text questions allow free text responses in the survey. By default, the form displays a text box with a single line input. If the text exceeds the size of the text box, it remains the same size and scrolls horizontally without line breaks. This is ideal for short answers. To force text input to adhere to a certain format, you can apply an input mask. You can also apply a regular expression to limit the text field to automatically reject responses that are not in a particular format, such as an email address or website URL.

The integer and decimal question types restrict the user to inputting applicable numerical values. In the constraint column for these question types, you can specify the minimum and maximum values to prevent a user from submitting their survey unless the answer is within the given range.

You can change the behavior of these question types and how they are presented by setting the appearance. To confirm which submission apps support a particular appearance, see Appearance.

Text appearance

Note:

In Survey123 Mobile, only the multiline appearance is supported for text questions.

In the Survey123 web app, the predictivetext and nopredictivetext appearances are not supported.

By setting the appearance column to multiline, a text question is presented as a multiline text box. This larger text box is ideal for long answers. It wraps text to a new line as it's typed and accepts carriage returns.

Note:

For forms used in the Survey123 field app, you can set the default height for the multiline text box by setting a defaultHeight parameter in the body::esri:style column. For example, entering defaultHeight=5 in the body::esri:style column will display five lines in a multiline text box when your survey is opened. If this is not set, a multiline text box will display three lines when your survey is opened.

By setting the appearance to predictivetext or nopredictivetext, a text question enforces that predictive text is enabled or disabled, respectively, on mobile devices. By default, Android has predictive text disabled for text questions, which can deactivate the speech-to-text function on some keyboards. Apply the predictivetext appearance to a text question to enable speech to text for that question. Predictive text is enabled by default on iOS.

By setting the appearance to geocode, a text question is used to search for and submit a geocoded address.

Appearances are also available for getting an InfraMarker tag ID and getting a value from a rangefinder.

Search for and submit a geocoded address

Note:

This section describes functionality that is only available in the Survey123 field app. This functionality is not available in Survey123 Mobile.

By setting the appearance column to geocode, a text question is used to search for and submit a geocoded address. When users begin typing an address, a series of autocomplete options appears, suggesting locations based on the default available locators for their organization. If the user isn't signed in, ArcGIS World Geocoder will be used. The geocode appearance requires an internet connection and will not function in an offline environment.

The final selected address will be sent to the feature layer as a string; however, the full geocoded data is temporarily stored as a JSON object before being sent, allowing individual properties to be extracted into other fields.

To extract specific properties from the JSON object, use the pulldata("@json") function in the calculation column of another question.

pulldata("@json", ${address}, "location.x")

pulldata("@json", ${address}, "searchCandidate")

The entire JSON object can be returned in a single text field by not defining an individual property.

pulldata("@json", ${address})

For more information about the pulldata("@json") function, see Retrieve a value from JSON.

Note:
Geocoding using the ArcGIS World Geocoding Service will consume credits. For more information, see Understand credits.

To set a specific locator to return results, supply the locator's item ID in the bind::esri:parameters column, for example, geocode=36ff9e8c13e042a58cfce4ad87f55d19. A locator used in an ArcGIS Online survey must be an item in ArcGIS Online. A locator used in an ArcGIS Enterprise survey must be an item in the same portal as the survey.

Available properties will differ depending on the locator used. The exception to this is the searchText property, which is available regardless of the locator used and returns either the exact string used to search for the address or the option selected from a list of results.

You can further control the presentation of a geocode appearance question by setting one of the following parameters in the body::esri:style column:

Note:

The indicator, proximity, maxResults, and suggestions parameters are not supported in the Survey123 web app.

  • indicator—Allows the geocoded results to show the direction and distance from the current device location. This parameter can be set to distance, direction, both values separated by a comma, or none. By default, this parameter is set to show only distance.
  • proximity—Controls whether the geocoded results only show results within a certain radius of the device's location. This parameter accepts a number, followed by any of the following standard units: m (meters), km (kilometers), ft (feet), mi (miles), or yd (yards). If no unit is provided, it will default to meters. If set to 0, proximity will not be accounted for in search results. By default, this parameter is set to on, allowing suggestions to be sorted by proximity without filtering out any locations because of distance.
  • maxResults—Controls the maximum number of results provided, for example, maxResults=10 will return a maximum of 10 possible results. By default, this parameter is set to show 6 results at maximum.
  • suggestions—This acts as an interface for the suggest operation in the ArcGIS REST API. When this parameter is set to yes, the drop-down list of potential locations is populated by the suggest operation. When this parameter is set to no or if the geocode service doesn't support the suggest operation, the list of potential locations is populated by the findAddressCandidates operation. By default, this parameter is set to yes.

Get an InfraMarker tag ID

Note:

This section describes functionality that is only available in the Survey123 field app. This functionality is not available in Survey123 Mobile.

Use the appearances described below to read data from or write data to an InfraMarker RFID tag.

By setting the appearance column of a text question to inframarker, you can define the information to write to a tag. This information can include assetOwner, assetName, latitude, and longitude, and the values can be derived from other questions in the survey. For example, the following expression in the calculation column writes the answers from the asset_name, asset_owner, lat, and long questions to the tag:

concat("assetName=", ${asset_name}, "&assetOwner=", ${asset_owner}, "&latitude=", ${lat}, "&longitude=", ${long})

By setting the appearance of another text question in the same survey to getinframarkerid, the unique 24 character InfraMarker tag ID is retrieved and stored in the survey.

For more information, see the InfraMarker documentation.

Get a value from a rangefinder

Note:

This section describes functionality that is only available in the Survey123 field app. This functionality is not available in Survey123 Mobile.

By setting the appearance column to rangefinder, a text question can accept either the full JSON object or a specified value that is returned from a rangefinder. When used to accept the full JSON object, this question should have bind::esri:fieldLength set to 1000 to ensure that the full value will fit.

When you set the rangefinder appearance for an integer or decimal question, it can accept a specific value that is returned from a rangefinder. Specify which measurement to store using one of the following values in the bind::esri:parameters column: height, azimuth, horizontalDistance, slopeDistance, or inclination. For example measurement=height will store only the height value that is returned from the rangefinder.

Integer appearance

Note:

In Survey123 Mobile, only the spinner appearance is supported for integer questions.

In the Survey123 web app, none of these integer appearances are supported.

By setting the appearance column to spinner, an integer question is displayed with buttons to increase or decrease the value by one. Selecting the button repeats the progression until the button is released.

By setting appearance to numbers, a highlighted integer question is accompanied by a custom numeric keyboard to enter a value. The keyboard also includes a button to make the value positive or negative.

The numbers appearance for an integer question in the field app

By setting appearance to calculator, a highlighted integer question is accompanied by a custom calculator keyboard to enter and modify a value.

The calculator appearance for an integer question in the field app

By setting appearance to distress, an integer question is displayed as a distress scale. A distress scale is a 10-point scale used to measure feelings such as stress, pain, and happiness.

The distress appearance for an integer question in the field app

Decimal appearance

Note:

In Survey123 Mobile, only the spinner appearance is supported for decimal questions.

In the Survey123 web app, none of these decimal appearances are supported.

By setting the appearance column to spinner, a decimal question is displayed with buttons to increase or decrease the last digit of the value by one. Selecting a button repeats the progression until the button is released.

The spinner appearance for a decimal question in the field app

When you use a default value to define the number of decimal places for a question, the spinner adheres to it. The following are examples of how the spinner handles different decimal values:

  • 1.0 increases to 1.1, 1.2, 1.3, 1.4
  • 3.07 increases to 3.08, 3.09, 3.10, 3.11
  • 2.000000 increases to 2.000001, 2.000002, 2.000003

By setting appearance to numbers, a decimal question is accompanied by a custom numeric keyboard to enter a value. The keyboard also includes a button to make the value positive or negative.

By setting appearance to calculator, a highlighted decimal question is accompanied by a custom calculator keyboard to enter and modify a value.

By setting appearance to thousands-sep, the answer to a decimal question appears with thousands separators. This does not affect the value sent as part of the survey response, only the display in the app. The separators are set by the device's locale and are applied only on opening a survey from the Drafts, Outbox, Inbox, or Sent folders or when the response is populated by a default value or calculation. Thousands separators do not appear when manually inputting a value.

The thousands-sep appearance for a decimal question in the field app