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**||Min/Max (Number)||Min/Max (Another Question)||Equal To (Another Question)||Min/Max (Fixed Date, Today, Tomorrow, Yesterday)|
|Attachment / Photo||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.
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.