How Required Field Validation Works
Joyfill automatically validates required fields based on:- Field requirement: Fields marked as required = true
- Field visibility: Hidden fields are always filtered out of the validation output
- Field values: Required fields must have non-empty values to be valid
validate(path:))
Use a path string when you only need validation for the whole document, one page, one field, or—on table and collection fields—a single row or single cell. Rules match validate(), scoped to the path depth. The result is a ComponentValidity: .page, .field, .row, .cell, or .notFound.
""(or whitespace-only) — same asvalidate();.page(Validation).pageId— fields on that page only;.page(Validation).pageId/fieldPositionId— that field when the first segment is the page that owns the position;.field(FieldValidity). If the page does not match, falls back to page-scoped validation forpageId.pageId/fieldPositionId/rowId— row-level validation for table/collection fields;.row(RowValidity). Use the row’s id from the field value. If the row is missing or not applicable,.notFound.pageId/fieldPositionId/rowId/columnId— cell-level validation for a column in that row;.cell(CellValidity). If the column or row is missing,.notFound.
/ is ignored. For .field, you can use the fieldValidity helper on ComponentValidity when convenient.
- Call validate() before form submission
- Check status for overall validation result
- Use fieldValidities to get specific field errors
- Required fields must have non-empty values
- Hidden fields are always filtered out of the validation output (conditional logic and
hiddenViews) - Page hidden: all of its fields are valid
- Table/Collection: validate their required columns per row. Each
FieldValidityincludesrowValiditieswith row-level and cell-level results (RowValidityandCellValidity) - Non-required table/collection fields still validate rows against required columns
- Navigate to invalid fields: use
fieldValidity.pageIdandfieldValidity.fieldPositionIdwithgoto()to navigate directly to invalid fields - Path-scoped checks: use
validate(path:)after a single edit, for one page submit, or with the same path shapes asgoto()— includingpageId/fieldPositionId/rowIdandpageId/fieldPositionId/rowId/columnIdfor table/collection row and cell validation