Inputvalidation

With the input_validation you can validate how data is created.

Input validation allows you to make sure the data being entered will correspond to the expected outcome, without the need to build an additional check (an indicator check e.g.).

Input validation is so-called "live validation", the user does not need to press enter or save, the validation happens before the value is stored in the database. This is one of the advantages of using input validation as opposed to running a check with a separate indicator, for which the user would first need to store the value in the template before we can check it.

A clear example of this, would be an input that should only allow positive values. First, that specific input validation needs to be created with the input_validation tag:

{% input_validation 'validation_positive_values' min:0 %}

With above logic, you are creating specific input validation, called validation_positive_values in which values can only be positive ( min:0 ). If such data (positive values) is not created (e.g. a negative value is being created), it will unreconcile the template in which the input gets created.

Validation

When the input validation has been created first, you will be able to use it for certain inputs, by using the newly created input_validation with the validation attribute in your input statement:

{% input custom.depreciation.value as:currency placeholder:0 validation:validation_positive_values %}

It will result in the following output, if one enters a negative value:

The user is made aware of the incorrect data creation, while the template also gets unreconciled with it.

📘

Input validation has a great benefit, not only from a UX perspective (as users see more clearly where incorrect data is created), but it also avoids building additional indicator checks in Liquid too.

Input validation is available for integer and currency inputs (sharing the same syntax), as well as dates:

# integer / currency
{% input_validation 'numeric_validation' max:10 min:0 %}

# date
{% input_validation 'date_validation' start_date:"2022-01-01" end_date:"2022-12-31" %}

📘

If input validation is shared across several templates within the same workflow, it can easily be created in a shared part and used anywhere.