How It Works
Joyfill automatically validates required fields based on:- Field requirement: Fields marked as required = true
- Field visibility: Hidden fields are always considered valid (even if required)
- Field values: Required fields must have non-empty values to be valid
Document-Level Validation
Validate all fields in your document:Handling Invalid Fields
When some required fields are empty:Individual Field Validation
Validate specific fields:Validation Messages
Required field validation provides standard error messages:Checking Field Requirements
Check if a field is required:Validation Rules
| Field Type | Condition | Valid? |
|---|---|---|
| Required | Has non-empty value | Yes |
| Required | Empty or null | No |
| Required | Hidden | Yes (always) |
| Optional | Any value | Yes (always) |
Key Points
- Required fields are automatically validated based on the
requiredproperty - Hidden fields are always valid, even if marked as required
- Validation errors use the format: “Component [title] is required”
- Call
editor.validate()anytime to get current validation status - Document validation checks all visible required fields at once