> For the complete documentation index, see [llms.txt](https://docs.work-relay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.work-relay.com/forms/form-building/events.md).

# Events

To provide efficient interaction between the user and the form one can use the following events to trigger various form actions:

## Form/Nested form events

* `onLoad` - occurs when form has been loaded
* `onBeforeSave` - occurs before form has been saved (form standard "Save" button or "Save" form API action)
* `onAfterSave` - occurs after form has been saved (form standard "Save" button or "Save" form API action)
* `onActivate` - occurs when form has been activated (Navigate "Return Back" form action or navigating back via breadcrumb for linked forms)

## Form input events

* `onChange` - occurs when the value of an element has been changed

## Button events

* `onClick` - occurs when a button is clicked

## List events

* `onChange` - occurs when the value of any of list checkboxes has been changed.
* `onLoad` - occurs when list has been loaded
* `onSelect` - occurs when a row has been selected in list

## Screen flow events

* `onStarted` — Is executed immediately when the Screen Flow is started. For a Screen Flow integrated into a form as a component, this will execute when the component is rendered on the form.
* `onScreenStarted` — Is executed each time a NEW screen of the Screen Flow is shown. This means that this event will not be executed for the first screen, and will never be executed if your Screen Flow has only one screen.

  This event has a standard output parameter, "**screenName**," that can be passed to event handler(s) as `{$Output.screenName}` merge field and will contain the name of that screen.
* `onFinished` — Is executed when the Screen Flow is finished.
* `onError` — Is executed if the ScreenFlow returns an error (e.g., when a user tries to pass a nonexistent input variable to the Screen Flow).

  This event has a standard output parameter, "**message**," that can be passed to event handler(s) as `{$Output.message}` merge field and will contain the error message returned by system.

## Form event setup

### Select the element

Select the element on the canvas (1).

Click "Add Events" button (2).

![](/files/3296f138681df7fd1a0f57c4d8217947899c8c46)

### Provide event details

* Select event type (3)
* Provide conditions if necessary (4)
* Click "Add" button to tie actions to the event (5)
* Select existing actions (6) or click "+" icon to create new ones (7)
* Pass conditions if necessary (8)

### Save changes

![](/files/2f488acdf43ed00d94ebfc3aee65c83d456fd027)
