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

Tabata Vossen -

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 or a time value. This information often has formatting requirements that participants must conform to, as incorrect data can really 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 entered data must conform to. Input masks are mainly used for the purposes of 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 ‘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 regular expressions

You can easily create a simple RegEx 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 RegEx that you’ll never have to see. If the standard format options don’t offer the flexibility that you need, you can use a regular expression to completely customise the format validation.

Complex regular expressions 

To create a more complex RegEx, 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*

Step 2: Field settings

  • Go to your form field and then in 'Advanced'.

Screenshot_2020-07-09_at_18.14.58.png

  • To create your input mask, simply type in your RegEx in the dedicated area ('Input mask'), as shown in the above screenshot.
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 does comply 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: 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!