Skip to content

Form Fields ​

The fields array contains objects that represent individual questions in the survey. Each object must include a display_type that determines how the input renders on the device.

Common Properties ​

These properties apply to all field types.

PropertyTypeRequiredDescription
questionstringYesThe label or question text shown to the user
display_typestringYesHow the input renders (see Display Types)
data_typestringYesThe data type of the value (see Data Types)
keystringYesUnique identifier for the field, used in conditionals. Must be unique across all fields
requiredbooleanYesWhether the field must be filled before submission
sectionstringNoThe id of the page this field appears on
hintstringNoHelper text displayed beneath the field
placeholderstringNoPlaceholder text shown inside the input
entry_titlebooleanNoIf true, this field's value is used as the display title for the collected entry
regexstringNoA regular expression pattern the value must match. Backslashes must be double-escaped (e.g. \\d)
column_namestringNoColumn name to use for this field's value in exported data, instead of key
auto_populatebooleanNoIf true, the value is filled in automatically (e.g. the enumerator from the login, or the date on submission)

Data Types ​

Data TypeUsed withDescription
textText inputs, drop_down, radioA single string value
numbernumber, rangeA numeric value
arraycheckboxA list of selected values
datedateA calendar date
fileimageA captured file, such as a photo

Choice-Based Properties ​

Used with drop_down, radio, and checkbox fields.

PropertyTypeRequiredDescription
choicesarray | objectYesThe selectable option values. Use an object to group choices
sub_keystringWith grouped choicesKey that stores the option chosen within a group
default_valuearrayNoPre-selected value(s). Must always be an array, even for single-select fields
json
{
  "question": "What is the type of house?",
  "display_type": "radio",
  "data_type": "text",
  "key": "type_of_house",
  "required": true,
  "hint": "Select the type of house",
  "default_value": ["BUNGALOW"],
  "choices": ["BUNGALOW", "APARTMENT", "DETACHED", "SEMI-DETACHED"],
  "entry_title": false
}

Grouped Choices ​

For long, two-level lists, choices can be an object. Each property name is a group, and its array holds the options in that group. The user first picks a group, then an option within it.

The group is saved under the field's key. The option chosen within the group is saved under sub_key, which must be unique across the survey like any other key.

json
{
  "key": "land_use",
  "sub_key": "detail_land_use",
  "question": "Primary Land Use",
  "display_type": "drop_down",
  "data_type": "text",
  "required": true,
  "choices": {
    "Residential": [
      "Low-density housing (detached / bungalow)",
      "Traditional / mud house",
      "Other"
    ],
    "Commercial": [
      "Retail shop / supermarket",
      "Open market / stalls",
      "Other"
    ]
  }
}

An entry with Commercial → Open market / stalls saves land_use as "Commercial" and detail_land_use as "Open market / stalls". Conditionals can test either key; see Grouped Choices in Conditionals.

Numeric & Text Properties ​

Used with text_field, text_area, and range fields.

PropertyTypeDescription
min_lengthnumberMinimum number of characters (text) or minimum value (range)
max_lengthnumberMaximum number of characters (text) or maximum value (range)
fromnumberThe starting value of a range input
tonumberThe ending value of a range input
stepnumberThe increment between values in a range input
json
{
  "question": "What is your age?",
  "display_type": "range",
  "data_type": "number",
  "key": "age",
  "from": 1,
  "to": 100,
  "step": 1,
  "required": true
}

Display Types ​

The display_type property controls how the field renders in the mobile app.

Display TypeDescriptionProperties
text_fieldSingle-line text inputmin_length, max_length, regex
text_areaMulti-line text inputmin_length, max_length
drop_downSingle-select dropdown listchoices, default_value
radioSingle-select radio buttonschoices, default_value
checkboxMulti-select checkboxeschoices, default_value
numberNumeric input with number keyboarddefault_value
rangeNumeric sliderfrom, to, step
dateDate picker—
emailEmail address input with keyboard optimizationregex
phonePhone number input with numeric keyboardregex
imageImage capture input—