How to check whether users have entered valid information
Jump to navigation
Jump to search
Introduction
There are a couple of checks that can be performed to ensure users are entering the correct information.
- One of the most simple checks you can do is known as 'stringlength'. This check will alert the users if the text they have entered is not the required length, for example, if a phone number is too short or long. You will see how to use this function below.
- A slightly more sophisticated check is 'patternmatch'. This function will check the text input by the user is the correct combination of letters and/or numbers. See more detailed explanation below.
stringlength
This command tells the intervention how many characters a user has entered into a free text interaction.
This can be useful if you want your users to create usernames that are a specific number of characters.
To use this function you will need to write an error message:
show namemessage if (stringlength (username) < 5)
In this example, the error message called “namemessage” will be shown to users if they have entered less than 5 characters in the interaction called “username”.