Configuring Custom Mask
Table of Contents
Use Case
In the CMW Platform, you can define a regular expression mask for the Text attribute display format. When the user enters the attribute value, the mask restricts it to the specified format. You can use the preconfigured E-mail address mask or specify a Custom mask.
In this article, we will create the Name attribute that can consist maximum of 10 Latin letters and the Phone attribute restricted to the US phone numbers in international format: +1 (XXX) XXX-XXXX.
Instructions
- Create the Name attribute:
- Data type — Text
- Display format — Custom mask
- Mask regular expression:
[A-Za-z]{10}
- Create the Phone attribute:
- Data type — Text
- Display format — Custom mask
- Mask regular expression:
\+1 \([0-9]{3}\) \([0-9]{3}\)-\([0-9]{4}\)
- Place the Name and Phone attributes on a form.
- The Name field will allow entering up to 10 upper and lower case Latin letters.
- The Phone field will allow entering up to 10 digits. Other phone number elements will be fixed.
Mask Regular Expression Syntax
Element | Description |
---|---|
[A-Za-z]{10} |
|
\+1 |
|
\([0-9]{3}\) \([0-9]{3}\)-\([0-9]{4}\) |
|