Event Overview Table
| Event Name | Event Triggers | Purpose |
|---|---|---|
onFocus | When a field receives focus | Track field focus events for analytics, validation, or UI updates |
onChange | When document data changes (field changes, field position changes, page changes, style changes, theme changes) | Handle document updates, save changes, or sync with external systems |
onBlur | When a field loses focus | Track field blur events for validation or cleanup operations |
onUploadAsync | When images or files are uploaded | Handle file uploads to external storage or processing services |
onCaptureAsync | When barcode is captured for table barcode cells | Handle camera capture functionality for barcode fields |
onFileUploadAsync | When images or files are uploaded | Handle field-specific file uploads with custom logic |
onFileClick | When a file in a field is clicked | Handle file interactions like opening, previewing, or downloading |
onFileDelete | When a file in a field is deleted | Handle file deletion with cleanup or confirmation logic |
onError | When errors occur (schema validation, license, etc.) | Handle and display errors to users |
Event Details
onFocus
- Triggered when: A field receives focus
- Purpose: Track field focus events for analytics, validation, or UI updates
params: Object containing:sdk: ‘js’v: 1type: ‘fieldPositionFocus’_id: Document IDidentifier: Document identifierfileId: File IDpageId: Page IDfieldId: Field IDfieldIdentifier: Field identifierfieldPositionId: Field position IDfieldRowId: Row ID (for table fields)fieldColumnId: Column ID (for table fields)fieldColumnIdentifier: Column identifier (for table fields)
e: Native DOM focus event
onChange
- Triggered when: Document data changes
- Purpose: Handle document updates, save changes, or sync with external systems
- Field changes - Field value or property updates
- Field position changes - Field position, size, or display changes
- Page changes - Page creation, updates, or deletion
- Style changes - Theme and styling modifications
- Theme changes - Toggle between themes
changelog: Array of change objects describing what was modifieddoc: The updated document object
onBlur
- Triggered when: A field loses focus
- Purpose: Track field blur events for validation or cleanup operations
params: Object containing:sdk: ‘js’v: 1target: ‘fieldPositionBlur’_id: Document IDidentifier: Document identifierfileId: File IDpageId: Page IDfieldId: Field IDfieldIdentifier: Field identifierfieldPositionId: Field position IDfieldRowId: Row ID (for table fields)fieldColumnId: Column ID (for table fields)fieldColumnIdentifier: Column identifier (for table fields)
e: Native DOM blur event
onUploadAsync
- Triggered when: Images or files are uploaded
- Purpose: Handle file uploads to external storage or processing services
params: Object containing upload context and document informationfileUploads: Array of file objects to upload
url: Public URL of uploaded filefileName: Name of the filefilePath: Path to the file
onCaptureAsync
- Triggered when: Barcode is captured for table barcode cells
- Purpose: Handle camera capture functionality for barcode fields
params: Object containing capture context
onFileUploadAsync
- Triggered when: Images or files are uploaded
- Purpose: Handle field-specific file uploads with custom logic
params: Object containing field information and upload contextfileUploads: Array of file objects to upload
url: Public URL of uploaded filefileName: Name of the filefilePath: Path to the file
onFileClick
- Triggered when: A file in a field is clicked
- Purpose: Handle file interactions like opening, previewing, or downloading
params: Object containing:fileId: File IDpageId: Page IDfieldId: Field IDfieldIdentifier: Field identifierfieldPositionId: Field position ID
urlObject: Object containing:url: File URLfileName: File namefilePath: File path
onFileDelete
- Triggered when: A file in a field is deleted
- Purpose: Handle file deletion with cleanup or confirmation logic
params: Object containing:fileId: File IDpageId: Page IDfieldId: Field IDfieldIdentifier: Field identifierfieldPositionId: Field position ID
urlObject: Object containing:url: File URLfileName: File namefilePath: File path
onError
- Triggered when: Errors occur (schema validation, license validation, etc.)
- Purpose: Handle and display errors to users
error: Object containing error information:- For schema validation errors: Validation error details
- For license errors:
{ code: 'LICENSE_VALIDATION_ERROR', message: string, type: 'license' }
Complete Example
Here’s a complete example showing how to use all events:Best Practices
- Async Event Handlers: Always use
async/awaitfor upload and capture events - Error Handling: Implement proper error handling in all async event handlers
- Loading States: Show loading indicators during file uploads
- Validation: Use
onBlurfor field validation - Analytics: Use
onFocusandonChangefor user interaction tracking - File Management: Implement proper cleanup in
onFileDeletehandlers - Performance: Debounce
onChangeevents if needed for frequent updates