Skip Logic & Conditionals
Two-layer conditional rendering and skip-to navigation in the patient UI.
Skip Logic & Conditional Rendering
The patient UI implements a two-layer conditional system: field-level depends_on visibility conditions and process-level skip_to_conditions navigation.
Layer 1 — Field-Level depends_on
Evaluated in formUtils.ts. Controls whether individual fields are visible or editable based on another field's value.
Configuration on a field:
{
"depends_on": ["fieldId", "operator", "valueToCompare"]
}Supported operators:
| Operator | Description |
|---|---|
= | Equals |
!= | Not equals |
>, <, >=, <= | Numeric comparisons |
in | Value is in a set |
not in | Value is not in a set |
any | Any of the provided values match |
all | All of the provided values match |
- If condition fails → field
hidden = true read_only_depends_oncontrolsdisabledstate using the same operator set
Layer 2 — Process-Level skip_to_conditions
Evaluated in patientConsent.tsx. Controls navigation between processes and subprocesses based on a question's answer.
Enabled by: allow_skipping = true on the question.
After a field value changes, afterFieldOnChange() checks the question's skip_to_conditions for a matching value → answer mapping.
Skip Actions (skip_to_type):
| Action | Behaviour |
|---|---|
"Process" | jumpToProcess(skip_to) — jump to another process by ID |
"SubProcess" | jumpToSubProcess(skip_to) — jump to a specific subprocess |
"End Process" | nextProcess() — advance to the next process in order |
"Abort Process" | jumpToEndProcess() — jump to the Close Down process |
"End Process & Restart" | Clear values and restart from the parent process |
"End Process & Resume" | Resume the parent process where it was left off |
Value operations on skip:
| Operation | Behaviour |
|---|---|
"iterate" | Save current values as a completed iteration (stacked in iterationValues) |
"reset" | Clear current form values |
Confirmation Before Skip
If requires_confirmation_message === "True" on a question:
afterFieldOnChange()intercepts the skip- Shows a confirmation modal with the configured message
- Confirm → execute the skip
- Cancel → revert the field value, suppress the skip