Skip to content
  1. Extras
  2. PageBuilder
  3. Field types
  4. Pro
  5. imask

Field imask

Version: Pro.

Why this type

A phone number, tax id, or card number is typed against a mask: extra characters are dropped as you type, not only when the page is checked before publish. The mask is set on the field (mask or a preset). The type is in PageBuilder Pro.

When to use

  • A phone number in a contact form
  • An SKU or serial number with a fixed length
  • A promo code that follows a pattern

Tips

Plain numeric use number. Value is string with mask literals per preset.

Similar types

  • text without format constraint
  • url for links, not phone mask

Schema

json
{
  "name": "phone",
  "type": "imask",
  "label": "Phone",
  "mask": "+7 (000) 000-00-00",
  "maskOptions": {
    "lazy": false
  },
  "tab": "Content",
  "width": 100,
  "active": true
}

Value

Masked string.

Section data

Key phone in the section data: masked string:

json
{
  "phone": "+7 (495) 123-45-67"
}

Chunk example

modx
<a href="tel:[[+phone]]">[[+phone]]</a>
fenom
<a href="tel:{$phone|escape:'url'}">{$phone|escape}</a>

Notes

Short mask: mask. Full IMask config: maskOptions (object or JSON string).

Common properties

For fields with name that are stored in the section data:

KeyTypeRoleCMP
tabstringGroup subtitle in the inspectoryes
width25–100Field width as % of the row (flex)yes
descriptionstringHint under the labelyes
defaultanyInitial value for a new sectionyes
activeboolfalse hides the field in the inspectoryes
requiredboolRequired on publish (draft still saves)yes
  • Also: mask or maskOptions (IMask JSON).

See fields overview.

See also