Page Events
Page Events attaches Studio scripts to runtime events for the current layout.
Use page events when a create or edit page needs behavior that depends on page initialization, field changes, or child-table actions.
Availability
Default layouts do not support page events. Create a custom layout before adding page events.
Page events run when the runtime page matches the layout.
Add A Page Event
Open Page Events and click Add Page Event.
Configure:
| Configuration | Description |
|---|---|
| Event Type | Selects when the script runs |
| Field Scope | Selects all fields or specific fields for field-change events |
| Child Table | Selects the child table for child-table events |
| Studio Script | Selects the script to execute |
Event Types
| Event Type | When It Runs |
|---|---|
| Main Form Init | When the main form page initializes |
| Main Form Field Change | When all or selected main form fields change |
| Child Table Row Add | When a row is added to a child table |
| Child Table Field Change | When all or selected child-table fields change |
| Child Table Row Remove | When a row is removed from a child table |
Field Scope
For field-change events, choose whether the script listens to all fields or only selected fields.
For child-table field-change events, selected fields belong to the selected child table.
Script Effects
Page event scripts can return effects for runtime behavior, such as field state, field value, field error, messages, notifications, and modals.
Child-table scripts can return child field state, child field value, and child field error effects.
For relation candidate filtering, configure Relation Data Range on the source search, multi_search, or foreign_key field instead of using a target-form page event. See Relation Data Range.
Use fieldOptionFilter when a small static choice field needs page-level option cascading. The script filters the target field by stable option values and keeps labels from the field configuration, so option display names can still be renamed or translated in field design.
return {
ok: true,
effects: [
{
type: 'fieldOptionFilter',
field: 'targetStatus',
allowedValues: ['processing', 'done'],
clearInvalidValue: true,
},
],
};
Return reset: true to restore the field's original configured options.
For script payloads, trigger details, and returned effects, see Page Interaction Events.