Skip to content

Input Masks

Input masks are configured on text questions with maskType and maskSettings. Use masks when respondents should type into a constrained format while still submitting a clean value.

Use validators as well when invalid data must be blocked on submit. A mask shapes input; validators express submission rules and error messages.

maskType can be:

  • none — no mask
  • pattern — fixed pattern with digit, letter, or alphanumeric placeholders
  • datetime — date/time pattern with optional min and max
  • numeric — formatted numeric value with separators, precision, and range
  • currency — numeric mask with prefix and suffix

Pattern masks use these placeholders:

  • 9 — digit
  • a — letter
  • # — digit or letter
  • \ — escapes the next character when a placeholder should be treated as literal text
{
"type": "text",
"name": "phone",
"title": "Phone number",
"inputType": "tel",
"maskType": "pattern",
"maskSettings": {
"pattern": "+1 (999) 999-9999"
},
"isRequired": true
}

Datetime masks use maskType: "datetime" with a pattern. Supported pattern tokens include:

  • m, mm — month
  • d, dd — day of month
  • yy, yyyy — year
  • H, HH — 24-hour hour
  • h, hh — 12-hour hour
  • MM — minutes
  • ss — seconds
  • TT, tt — AM/PM marker
{
"type": "text",
"name": "appointment",
"title": "Appointment date and time",
"maskType": "datetime",
"maskSettings": {
"pattern": "mm/dd/yyyy HH:MM",
"min": "2026-01-01T00:00:00",
"max": "2026-12-31T23:59:59"
}
}

Numeric masks support:

  • allowNegativeValues — defaults to true
  • decimalSeparator — defaults to .
  • precision — defaults to 2
  • thousandsSeparator — defaults to ,
  • min and max — accepted numeric range
{
"type": "text",
"name": "budget",
"title": "Budget",
"inputType": "text",
"maskType": "numeric",
"maskSettings": {
"precision": 0,
"thousandsSeparator": ",",
"allowNegativeValues": false,
"min": 0,
"max": 100000
}
}

Currency masks extend numeric masks and add:

  • prefix — text displayed before the value
  • suffix — text displayed after the value
{
"type": "text",
"name": "monthlyFee",
"title": "Monthly fee",
"maskType": "currency",
"maskSettings": {
"prefix": "$",
"precision": 2,
"thousandsSeparator": ",",
"allowNegativeValues": false,
"min": 0
}
}
  • Use inputType: "email", url, date, or number for native browser behavior. Use masks when the display format itself matters.
  • Use maskType: "pattern" for phone numbers, serial numbers, postal codes, and IDs.
  • Use maskType: "datetime" only when a custom date/time text format is required. Use inputType: "date" for ordinary date pickers.
  • Use maskType: "numeric" or currency when users need grouped digits or fixed precision.
  • Pair masks with Validators or min/max properties when the form must reject out-of-range values.