Field Validation

Validation Options

Validation is used to test entered data against a set of rules in order to ensure that the data in the system is kept clean and logical. The validation settings for any field can be found by looking at the properties of the field in the form designer.
image1

Mandatory Fields

Setting a field to Mandatory will require that the field has data in it before the record can be saved.
In this example both the First and Last name are set as Mandatory fields.
image2

Pressing the Save button results in the following message:
image3

Validation Formula

Validation Formulas provide a similar function to setting a field to mandatory but allow for additional options and more flexible logic.
There are two additional variables available when working with Validation Formulas, those are $thisColumn and $thisValue. As the names suggests these variables retrieve their own column name and value name, this is helpful in allowing you to setup multiple fields using the exact same formula.

Using Validation Formula we will now enforce this rule

  1. Neither the First nor Last Name should contain have a number

The following formula has been applied to both the First Name and Last Name validation rules.
image4

Here is the input data:
image5

When trying to save the record the follow error appears:
image6

The validation rule has worked however the error returned could be friendlier. The Validation formula allows the configurator to specify the message that is returned by simply returning the value in the formula. Here is an updated formula that will return a custom error message.
image7

Using the same data as above the error message is now more clearly indicating the validation issue.
image8

Further Validation Formulas

The form from above has been expanded further and more validation rules are required to ensure the integrity and cleanliness of data being passed in.
image9

Here are the new rules that need to be implemented:

  1. If user has a driver’s license then then must provide the date they got their license
  2. In the case that a user does have a driver’s license, the date that a user got their license must be before today’s date

The field names for the new fields are: [Has Drivers License] and [Date of Drivers License]
Condition 1 is indicating that the [Date of Drivers License] field is only mandatory in a specific case. This can be achieved with the following formula:
image10

Inputting this data:
image11

Results in this message:
image12

Meeting Condition 2 is a potentially a simple addition to the formula something like this:
image13

However the message returned would not properly reflect the validation rule that might fail. This formula will provide a custom message based on the failed validation rule.
image14

NOTE: Returning TRUE or NULL will result in successful validation. Returning FALSE or a string will result in failed validation.

Validation Tags

Validation tags are a way of control non-Save events through validation rules. A tag is required to be on a least 1 field and at least 1 button in order to be effective.
image15

In previous examples validation could only prevent the record from Saving, however in this situation we have a button that will trigger an email, however we don’t want the button to be able to send an email until the Email Address field has been filled in.
On the Email Address field enter a custom validation tag – the name can be anything, it just has to match the tag placed on the button.
image16

On the button properties ensure that Causes Validation is set to yes and then enter the tag that matches the tag placed on the field.
image17

It is possible to place the same tags on multiple fields
With no data entered the Send Email button will now only work when the email address field has some data entered.

image18

Validation Tags with Validation Formula

Building off of the email example it is worth adding validation to ensure that the Email Address is in a valid format. This includes the following:

  1. There is an “@” symbol
  2. At some point after the “@” symbol and before the end of the input there will be a full stop (“.”)

Field Validation settings:
image19

Input data:
image20

Error message:
image21

Input data:
image22

Success:
image23

Related Articles