Conditional Validation
Conditional validation applies a constraint only when the respondent's current path requires it. Permanent field type and schema constraints remain in the base form; dependency rules add path-specific requirements.
Example: Qualified Project Budget
Assume engagementType contains fixed-scope and ongoing, and budget is a number field.
Create Fixed scope needs a qualified budget:
- When
engagementTypeEqualsfixed-scope. - Make
budgetRequired. - Set minimum value to
1000. - Set the description to explain the minimum.
If the budget field should not appear for ongoing work, create the inverse rule: when the engagement type does not equal fixed-scope, hide the field and make it optional.
Available Validation Effects
Rules can:
- make a field required or optional;
- set a regular-expression pattern;
- set minimum or maximum text length;
- set minimum or maximum numeric value;
- forbid a value from matching another field; and
- change the field description so the active requirement is explicit.
Use type-appropriate values. A numeric minimum belongs on a numeric field; a length belongs on text. Keep permanent constraints, such as an email's format, in the field schema rather than duplicating them in every path.
Hidden Fields and Stale Answers
A hidden field is not automatically a reason to retain a required constraint. Pair Hide field with Make optional when the field is outside the active respondent path. Test what happens when a respondent enters a value and then changes an earlier answer so that the field becomes hidden.
Use Clear value only when the business rule requires discarding the prior answer. Otherwise, make the retention behavior explicit in the workflow and review the submitted data accordingly.
Verify Both Client and Server Behavior
In Map & test, verify the affected field's required state, active validation, and trace. Then use respondent preview to confirm the visible message and focus behavior.
The published API evaluates the same active dependency state before accepting a submission. Direct requests cannot bypass a required field or active constraint by skipping the browser. Publication itself is blocked when the validation rule is malformed or references a field that no longer exists.
