Content Architecture
How to validate a field based on another field's value in Agility CMS, beyond built-in required/length/format rules — using regex for single fields and a custom field app for cross-field rules.
Agility content models support built-in field validation — required, length, and format constraints — plus regular-expression validation on a single field via the model's Advanced tab for precise format rules (emails, phone numbers, postal/zip codes, custom patterns). For logic that depends on another field's value — for example, "if Status is Published, then a Publish Date is required," or "End Date must be after Start Date" — validation is implemented with a custom field app: a developer-built field extension that has access to the item's values and enforces the conditional/cross-field rule. Agility does not use server-side "validation scripts"; per-field formatting is handled by regex, and anything beyond a single field is handled by a custom field app.
Standard model field settings cover the common cases:
These rules evaluate a single field in isolation and do not reference other fields.
When a rule must consider more than one field, it is implemented with a custom field app — a custom field/UI extension you build and register on the content model. Because the app renders a field within the editor and has access to the item's other field values, it can enforce conditional and cross-field rules and surface a validation message to the editor.
Typical cross-field / conditional patterns a custom field app can enforce:
A worked custom-field-app example (e.g. End Date > Start Date) isn't published here; contact Agility for current sample code and guidance.
| Need | Use |
|---|---|
| Single field required / length | Built-in field settings |
| Single field must match a format | Regex validation (Advanced tab) |
| Rule depends on another field's value | Custom field app |
| Rule depends on external data/service | Custom field app (calling your service from the app) |
| Area | Agility | Implementation partner / customer |
|---|---|---|
| Built-in + regex validation | ✅ Provided in the content model UI | ✅ Configures patterns and messages |
| Cross-field / conditional validation | ✅ Provides the custom field app framework | ✅ Builds, tests, and maintains the custom field app |
| Editor experience of errors | ✅ Surfaces validation failures in the editor | ✅ Writes clear, actionable validation messages |
| Governance | — | ✅ Decides which rules are enforced and documents them for editors |