Field Validation


Last Update vor 4 Monaten

Validation refers to the optional rules you can configure the fields with, so as to validate the data that the customers input before being able to submit the form. This is not to be confused with the Required checkbox that will determine if the field is or is not required to submit the form, as validation rules can exist regardless of whether or not the field is required (that means, no input at all will pass any validation that is not the Required validation)

The validation rules are common to the type of content in the field:

  • Texts: equal, not equal, shorter or longer than X characters, start or end with, include or not include, match regex
  • Numbers: must be greater or less or equal than, must be or not be equal
  • Dates: must be more or less than (relative date), must be on or after or before, or on day of the month, month of the year, or year
  • Boolean (checkboxes): must be true, must not be false
  • And a couple of fields have inherent validation rules: an email address needs to be in a valid email format, and a password must be at least 5 characters long.

For a practical case, let's say that we want to restrict the form submission to only adult members, 18 years of age or older. We could then add a validation rule to our Birthday field as per require the member to be born at least 18 years ago, and check the field as Required. The set-up is pretty intuitive.

If you predefine the values the customer can select with input types like radio, dropdown or multi-choices, please make sure that they output values that meet the validation rules you are creating.

You also need to take into account that different validation rules applied to the same field will aggregate to each other, so it wouldn't make sense to have illogical combinations of them.