Conditional Visibility and Validation Rules on Form Fields
How to control when a field appears (conditional visibility) and what values it accepts (validation rules) in the TrustPager form builder. Covers operators, cross-field comparisons with multiplier/divisor, custom error messages, and how the two features compose.
Two features in the form builder give you precise control over what your form shows and what it accepts: conditional visibility hides or reveals a field based on what the person has already entered, and validation rules block submission when a field's value doesn't meet a requirement you define. Both are configured in the field editor panel — select any field in the builder to open it.
You'll find both features at https://app.trustpager.com/form-builder/<template-id>: select a field, then scroll the right-hand panel to Conditional visibility or Validation rule.
Conditional Visibility
Conditional visibility lets you show or hide a field depending on the value of another field that appears earlier in the form. Use it to keep forms short and focused — only ask a question when the answer is actually relevant.
Setting it up
- Select the field you want to show or hide conditionally.
- In the field editor panel, toggle on Conditional visibility.
- Add one or more conditions. Each condition specifies:
- Which field to watch (any earlier field on the same form).
- The operator: is, is not, is any of, is filled, or is empty.
- The value to compare against (for is, is not, and is any of).
- If you add more than one condition, choose whether All or Any must be true for the field to appear.
The field is hidden by default and only appears when the condition is met. If the field was visible and then its condition stops being true (the person changes an earlier answer), the field hides again and any value they entered is cleared.
Example: A form has a "Do you have an existing policy?" yes/no field. You add a "Policy number" text field with the condition: Do you have an existing policy? is Yes. The policy number field only appears when the person answers yes.
Validation Rules
Validation rules apply to number and date fields. When a rule fails, submission is blocked and your custom error message appears inline next to the field. The person can't proceed until the value satisfies the rule.
Validation runs on the public form, the internal form (when you fill it yourself in the builder), and the client portal fill surface.
Setting it up
- Select a number or date field in the form builder.
- In the field editor panel, scroll to Validation rule and toggle it on.
- Add one or more rules. Each rule specifies:
- The operator — for number fields: must be at most (<=), must be at least (>=), must be less than (<), must be greater than (>). For date fields: must be after, must be before.
- The comparison target — either a fixed value you type in, or another field on the same form.
- The error message shown to the person when the rule fails.
- If you add more than one rule, choose whether All or Any must pass for submission to be allowed.
Cross-field comparisons with multiplier and divisor (number fields)
When comparing against another field, number fields let you optionally apply a multiplier and a divisor to the other field's value before the comparison runs. This lets you express proportional limits without needing a separate calculated field.
For example, to check that a value is at most 70% of another field divided by 12, you set the comparison target to that field, the multiplier to 0.7, and the divisor to 12. The rule then checks: this field <= other field × 0.7 ÷ 12.
Date validation
For date fields, the comparison target can be a fixed date or another date field on the form. Use this to enforce ordering between dates — for example, adding a rule on an "End date" field with the operator must be after and the comparison target set to the "Start date" field. If the person enters an end date that falls before the start date, submission is blocked with your error message.
Worked example: capping a monthly benefit
An insurance quote form needs to enforce that an income protection monthly benefit cannot exceed 70% of the applicant's monthly income. Here is how to set it up:
- Add a number field labelled Client Annual Income to the form.
- Add a number field labelled Income Protection Monthly Benefit.
- Select the Income Protection Monthly Benefit field and open the field editor panel.
- Toggle on Validation rule and add a rule:
- Operator: must be at most (<=)
- Comparison target: Another field → select Client Annual Income
- Multiplier: 0.7
- Divisor: 12
- Error message: Your monthly benefit can't exceed 70% of your monthly income.
When someone enters a benefit that exceeds the cap, submission is blocked and they see the message inline. The calculation — annual income × 0.7 ÷ 12 — runs entirely in the form. No external system is needed to catch the error.
Using both features together
A field can have conditional visibility and a validation rule at the same time. The validation rule only runs when the field is visible — if the field is hidden by its conditional visibility setting, any value it holds is not validated and does not block submission.
This means you can build forms that adapt to the person's answers and still enforce the right constraints on whatever fields are actually shown.
Note: Validation rules check deterministic conditions you define — comparisons between numbers and dates. They are not a substitute for checks that depend on external data or calculations your platform needs to perform after submission. Use validation rules to guide the person filling the form; use post-submission automations for anything that requires a system lookup.