Objective
After reading this article, you will understand how to set up rules in forms that validate data that is entered by users completing the forms.
Before you get started
These articles might be helpful before you read further:
There are often times when we want to make sure that forms users are entering valid data. In other words, for certain questions, it might be important that they don't enter data which doesn't make sense, or does not align with our needs for any individual data point. In order to address this, we can put validation rules in place to ensure that accurate data is being collected.
There are three types of data validation that can be used within Youreka - In-Form Validation, Soft Validation, and Salesforce Validation Rules. In the section below, we'll break down each.
In-Form Data Validation
Use in-form data validation to ensure that users are entering accurate information into forms. In-Form validation works online or offline, and is enforced as the user turns pages, or saves/submits a form.
You can set up data validation from within the question editor. See the screenshot below, and the corresponding explanations below the image.
- Question Text - This is the question label which will be seen by users as they fill out a form.
- Question Type - This is the type of question. Data validation can be applied to questions of the following types: Currency, Date, Date/Time, Field Link, Number, and Percent.
- Integers/Decimals - This setting allows you to define how many integer and decimal places this question will allow.
- Value Range - This defines the logic behind the data validation. By selecting None, the form will not validate the information entered for this question. Min/Max allows you to set a range, and Equals allows you to define a specific value that the answer for this question should match.
- Min/Max Comparison - These settings allow you to define how the comparison will take place. Use logic operators such as greater than, less than or equal to.
- Compare To - These settings define which values will be used in the comparison. You can either hardcode a fixed value, or compare with values from other questions in the form.
- Comparison Value/Question - These settings allow you to define which value / question will be used in the comparison. If you choose to used a fixed value (see 6), this setting allows you to define that value. If you choose to use a different question in the form, this setting allows you to pick which question will be used for the comparison.
- Error Message - This setting allows you to customize the message that users will see if their answer does not comply with the validation rules defined for this question.
Different types of questions offer different types of validation options. The grid below demonstrates which options are offered, by question type:
Types of Validation | |||||||
Question Type | Required* | Basic Format Check** | Regular Expressions | Min/Max (Number) | Min/Max (Another Question) | Equal To (Another Question) | Min/Max (Fixed Date, Today, Tomorrow, Yesterday) |
Attachment / Photo | x | ||||||
Checkbox List |
x | ||||||
Currency | x | x | x | x | |||
Date | x | x | x | x | x | ||
Date/Time | x | x | x | x | |||
E-Signature | x | ||||||
Email Address | x | x | x | ||||
Long Text | x | x | |||||
Multi-select Picklist | x | ||||||
Number | x | x | x | x | |||
Percent | x | x | x | x | |||
Phone | x | x | |||||
Picklist |
x | ||||||
Radio Button | x | ||||||
Text | x | x | x | ||||
URL | x | x |
*Required simply means that for this type of question, you can require an answer. Required questions are validated upon form save/submit, and are not validated upon page turns
**Basic format check means that Youreka will check to see that an email address are properly formatted. For example, if an email answer doesn't contain an @ symbol, the user will be notified.
Text Validation - Regular Expressions (Regex)
Regex extends in-form data validation for text type questions. It allows for powerful validations to be written ensuring that users are entering accurate information into text fields.
On any text type question, enter the desired Regular Expression into the Match Regex Pattern field. Include an optional Error Message in Error Message for Regex Validation. Save your question and the validation will begin checking user's entries when the form template is published.
Reading on Advanced Regular Expressions
The example given above is comparably simple when considering what can be achieved using regex. For more details, advanced tools and use cases check out these links below:
Configure Date/Datetime Validation
Date and Datetime validation allows Youreka to ensure that users are entering accurate information into date and datetime fields, based on other dates on the form they're completing.
To ensure that a date or datetime answer on your form equals another date or datetime answer on your form, select a Value Range of Equals. Under Equals Value for Question select from one of the date or datetime questions listed.
If you would like to ensure that a date or datetime answer falls between two other date or datetime answers on your form you may do that as well.
- Select Min/Max is Value Range, select Another Question Value in the Minimum and/or Maximum field.
- Select one of the date or datetime questions listed and define your Custom Validation Error Message.
Soft Validation
Youreka offers the ability to gently remind end users throughout their form experience. This can be done using the display text element in the form builder.
These types of validation aren't technically enforced when the user submits/saves a form. In other words, a form is not prevented from being submitted if these messages are shown. Instead, they simply inform an end user if they are entering inappropriate data. In our experience, these messages can be incredibly helpful at ensuring that end users are answering questions accurately. They provide for a smooth end user experience.
These messages can be displayed using Youreka's Conditional Display Logic.
The following question types can be used to drive the display logic of these messages:
- Number - Greater Than, Less Than, Equal To, Blank, Not Blank
- Text - Equal To, Not Equal To, Blank, Not Blank, Equal To Question, Not Equal To Question
- Picklists - Equal To One or Several Options
Users can use AND/OR filter logic to create complex display criteria.
Salesforce Validation Rules
Salesforce validation rules are applied when users submit Youreka forms (and the end user is online). If you do not set up data validation in the Template Builder, but you have a validation rule that exists on a field linked Salesforce object, a user who has entered an invalid value would still see the error message associated with that validation rule on the form when they try to submit.
Comments
0 comments
Please sign in to leave a comment.