Introduction
Until now, input validation in Silverfin templates supported inclusive boundaries using min and max. This meant that the boundary value itself was considered valid.
For example:
{% input_validation "inclusive_example" as:numeric min:0 max:10 %}
{% input custom.example.value as:integer validation:inclusive_example %}
- Accepts any number between 0 and 10
- Includes both 0 and 10
However, in many accounting and tax contexts, you may want to exclude the boundary itself (e.g. disallowing zero in positive/negative validations).
To solve this, two new attributes have been introduced:
min_exclusivemax_exclusive
Usage
1. Excluding the Minimum:
{% input_validation "exclusive_min" as:numeric min_exclusive:0 %}
{% input custom.example.value_min as:integer validation:exclusive_min %}
Accepts: 1, 2, 100
Rejects: 0 and all negative numbers
2. Excluding the Maximum:
{% input_validation "exclusive_max" as:numeric max_exclusive:100 %}
{% input custom.example.value_max as:integer validation:exclusive_max %}
Accepts: 0, 50, 99
Rejects: 100 and all numbers above
3. Combining Exclusive Boundaries:
{% input_validation "strict_range" as:numeric min_exclusive:0 max_exclusive:100 %}
{% input custom.example.value_strict as:integer validation:strict_range %}
Accepts: 1–99
Rejects: 0 and 100
Key Differences from min / max
| Attribute | Behavior example |
|---|---|
min: 0 |
Accepts 0 |
min_exclusive: 0 |
Rejects 0, requires >0 |
max: 100 |
Accepts 100 |
max_exclusive: 100 |
Rejects 100, requires <100 |
Best Practices
- Use
min_exclusive: 0to enforce strictly positive numbers - Use
max_exclusive: 0to enforce strictly negative numbers - Combine
min_exclusiveandmax_exclusivefor open intervals (strict ranges) - For cases where 0 is valid, continue using
min/max