Button Events
Button events are triggered when the user clicks a button. The event fired depends on the configured Button Type. The backend uses the widgetName and widgetEvent properties on the incoming request to identify the event and respond appropriately.
Event Summary
| Button Type | Event Sent | Backend Event Required |
|---|---|---|
| Save | onSave | Yes |
| Custom | onClick | Yes |
| Cancel | onCancel | Yes |
onPrint | Yes | |
| None | (none) | No |
Event Details
onSave
Fired when the user clicks a Save button.
The form data is collected and sent to the backend. The backend should:
- Detect the event via
widgetEvent === "onSave" - Validate and persist the form data
- Return an appropriate response (e.g., close the form, navigate away, or show a confirmation message)
onClick
Fired when the user clicks a Custom button.
Use this type for any backend-driven action that does not fit the built-in Save, Cancel, or Print behaviors. The backend should:
- Detect the event via
widgetEvent === "onClick" - Identify the specific button via
widgetName - Execute the required logic (e.g., trigger a workflow, open a modal, call an external API)
- Return an appropriate response
If a form has multiple Custom buttons, each button should have a unique Name so the backend can distinguish which button was clicked using widgetName.
onCancel
Fired when the user clicks a Cancel button.
The backend should:
- Detect the event via
widgetEvent === "onCancel" - Execute the required logic (e.g., discard changes, navigate away, close the form)
- Return an appropriate response
onPrint
Fired when the user clicks a Print button.
The backend should:
- Detect the event via
widgetEvent === "onPrint" - Execute the required logic (e.g., prepare a print-ready version of the data, trigger a PDF export)
- Return an appropriate response