Data validation

Basic validation

Data validation can be applied to any form component. The data validation of a field, are configured on the component itself, and can be found by viewing the Validation tab within the components settings. The data validation of a field, are configured on the component itself, and can be found by viewing the Validation tab within the components settings.

The following options are available: 

  • Required: If checked, the field will be required to have a value upon submission.
  • Minimum length: The minimum number of characters required to be entered for this field.
  • Regular Expression Pattern: The regular expression pattern test that the field value must pass before the form can be submitted. See regex101.com for help with writing regex expressions.

Advanced data validation

You can use javascript to perform validation on a field. The way to respond is by setting the valid variable. If it is set to true then the validation passes. If you set it to a string, the validation fails and the validation message is set to whatever the valid variable is set to.

In addition, input variable is set to the value that has been entered in the field. The component variable is set to the definition of the field.

You can also reference other resources and properties for validation. For example, if there is a user resource with a password field, you can use its value with user.password

Use cases

Advanced data validation is mainly required when you want to validate a combination of multiple fields and/or values. Here are few use cases: 

  • Consistency checks:
    • The value of 1 input should never be higher/lower of another
    • Control sum at the end entered by the user (e.g. nested forms to add expenses)
  • Text
    • Show a follow-up questions when a specific word occurs
    • Check if a word occurs multiple times
    • Check for minimum of x characters and y digits
  • Conditional based on the validation of multiple fields
    • If a = 1 AND b = 2, then
  • Multiple choice for an app reference:
    • Error if value = item a OR item = b
Was this article helpful?

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Need Support?

Can't find the answer you're looking for?
Contact Support