Tech tip: Set up an input mask on a form field to ensure participants fill it with properly formatted data

T.V -

As you create forms in Qualifio, you’ll often use text boxes (numeric or alphanumeric fields) to capture information like a participant’s loyalty card, a serial number, a phone number or a time value. This information often has formatting requirements that participants must conform to, as incorrect data can be a nuisance. With input masks, you can allow participants to enter valid data. Below, you will find information on how to customise the format of your input mask.

What is an input mask?

An input mask governs what a participant is allowed to enter as an input in a numeric or alphanumeric field. It’s kind of like a template or a set format that the entered data must conform to. Input masks are mainly used for data integrity: they ensure that you will capture data in a consistent format by specifying a pattern that the entered text should match.

Use our demo campaign to try out input masks:

Step 1: Define your input mask

In Qualifio, you can use a mask or "Regular Expressions" (RegEx) to ensure participants provide information in the right format. Determine the format that will be accepted by following the directions below.

Simple mask

You can easily create a simple mask using "A" for letters and "9" for numbers. For example, a licence plate could be AA-999-AA. An alphanumeric field using this regular expression would only accept data in this format.

Tip
To allow participants to enter a date, postal code, phone number or VAT number, you can also use the standard fields that are already set up in your account! These use pre-defined masks that you’ll never have to see. If the standard format options don’t offer the flexibility that you need, you can use an advanced mask or a Regular Expression to completely customise the format validation.

Advanced mask

To create a more complex mask, you can use specific characters. Explore the table below to get an idea of what you can accomplish.

Accepted characters

The following characters can be used in the "Input mask" settings:

Character Description
A Any uppercase alphabetic character.
a Any lowercase alphabetic character.
9 Any single numeric character.
* This is a wildcard; allows any character.
/ Allows the "/" character.
. Allows the "." character.
- Allows the "-" character.
% Allows the "%" character.
( Allows the "(" character.
) Allows the ")" character.
+ Allows the "+" character.
: Allows the ":" character.
Any other letter than a or A Any other alphabetic character specifies itself. For example, "b" allows users to enter "b".
Any other digit than 9 Any other numeric character specifies itself. For example, "1" allows users to enter "1".
Any other character Any other character specifies itself.

For example, if you would like to require 4 capital alphabetic characters followed by any character, you should use: AAAA*

Regular Expression

A regular expression (shortened as RegEx or RegExp) is a sequence of characters that specifies a match pattern in text. It's used to search for more complex patterns in input fields. To set up your Regular Expression, you can use RegEx validators such as https://www.debuggex.com or https://regexr.com, or use your preferred AI bot.

Examples

Validation RegEx
Email ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
Email (Cyrillic address with Latin domain name) ^[\w\u0430-\u044f]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,4}$
Password with at least one number, one lowercase and one uppercase letter and at least 6 characters (?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}
Password with rules at least one number, one lowercase, one uppercase, a special character and 12 characters ^(?=.*[a-z].*)(?=.*[A-Z].*)(?=.*[0-9].*)(?=.*[^a-zA-Z0-9].*).{12,}$
Phone number (France) ^(0|\+33|0033)[1-9][0-9]{8}$
Phone number (Belgium land) ^((\+|00)32\s?|0)(\d\s?\d{3}|\d{2}\s?\d{2})(\s?\d{2}){2}$
Phone number (Belgium mobile) ^((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3}$
Phone number (Belgium mobile or land) ^(((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3})|(((\+|00)32\s?|0)(\d\s?\d{3}|\d{2}\s?\d{2})(\s?\d{2}){2})$
Phone number (Cyprus/Greece) ^(((\+|00)357)(\d{8}))$|^(((\+|00)30)(\d{10}))$
Hour format (HH:MM) ^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$
Postcode – 5 digits (specific range from 28000 to 28055) ^280(([0-4][0-9])|(5[0-5]))$
String only with letters lowercase or uppercase long of 4 characters ^[a-zA-Z]{4}$
String only with letters or numbers and minimum 3 to max 8 chars ^[a-zA-Z0-9]{3,8}$
String for "Firstname Lastname" ^[A-ZÀ-ÖØ-Þ][a-zA-ZÀ-ÖØ-Þ'-]*\s(?:[A-ZÀ-ÖØ-Þ][a-zA-ZÀ-ÖØ-Þ\s'-]*|de\s[A-ZÀ-ÖØ-Þ][a-zA-ZÀ-ÖØ-Þ\s'-]*)$
Identification number with this format xx-xx-xx-xx-xx ^([0-9]{2}\-{1}){4}[0-9]{2}$

Step 2: Field settings

  1. Go to your form field and then to "Advanced".
  2. To create your input mask, simply type in your Validation Mask or RegEx in the dedicated area ("Input mask"), as shown in the below screenshot.

Screenshot_2020-07-09_at_18.14.58.png

Note
In most cases, participants won't have to manually enter the necessary dashes, parenthesis and other formatting.
  • By themselves, regular expressions do not offer insight into the format the field requires. To inform participants of the required formatting, you could use a Placeholder text.
  • You can also add an Error message for the participant, as data entry is validated only if it complies with the predefined format (i.e. your RegEx). If it does not comply with it, an error will appear:

Screenshot_2020-07-10_at_15.43.51.png

  • Save your form field and preview it. We recommend you test the input mask during the configuration process – this will help you make sure that you didn't use the wrong one.

Note: Alternatively, you can also set a minimum and/or maximum character count for entries in the field. However, you cannot use both the minimum/maximum character count and the input mask at the same time.

Happy validating!

Was this article helpful?

Can’t find the answer you need?

Send us a question and connect with an expert to get personal assistance.

Contact support

Vous ne trouvez pas les réponses que vous cherchez ?

Nous sommes là pour vous aider. Envoyez-nous une demande en direct !

Contacter le support
helpcenter experts