Available Events
| Event | When Triggered | Purpose |
|---|---|---|
| onChange | Field value changes | Track form changes |
| onFocus | Field gains focus, or page gains focus | Handle field or page focus |
| onBlur | Field loses focus, or page loses focus | Handle field or page blur |
| onUpload | File upload requested | Handle file uploads |
| onCapture | Barcode scan requested | Handle barcode scanning |
onChange Event
Triggered when any field value changes in the form. Parameters:- changes: [Change] - Array of change objects describing what was modified
- document: JoyDoc - The fully updated document with all changes applied
onFocus Event
Triggered when a field receives focus, or when a page becomes the current page (page focus). Parameters:- event: Event — Either a field focus or a page focus. Use
event.fieldEventfor field focus, orevent.pageEventfor page focus.
event.fieldEvent— Set for field focus; containsFieldIdentifier(e.g.fieldID,pageID,fieldPositionId).event.pageEvent— Set for page focus; containsPageEventwithtype: "page.focus"andpage: Page.
onBlur Event
Triggered when a field loses focus, or when the user leaves a page (page blur). Parameters:- event: Event — Either a field blur or a page blur. Use
event.fieldEventfor field blur, orevent.pageEventfor page blur.
event.fieldEvent— Set for field blur.event.pageEvent— Set for page blur; containsPageEventwithtype: "page.blur"andpage: Page.
onUpload Event
Triggered when a file upload is requested for image or file fields. Parameters:- event: UploadEvent - Upload event details
- fieldEvent: FieldIdentifier - The field requesting upload
- multi: Bool - Whether multiple files are allowed
- uploadHandler: ([String]) -> Void - Callback to provide file URLs
onCapture Event
Triggered when camera capture is requested for Barcode cell. Parameters:- event: CaptureEvent - Capture event details
- fieldEvent: FieldIdentifier - The field requesting capture
- captureHandler: (ValueUnion) -> Void - Callback to provide captured content
onError Event
- Used to listen to errors during document processing.
- error: JoyfillError — details about the failure.
- Error types include:
- schemaValidationError — Document schema validation failures
- schemaVersionError — SDK and document version compatibility issues