When the user or the system performs an action on a form component, the form component produces an event of a certain type. The type is defined by the action that caused it.
If the form component has a listener for the type of the event, the event triggers the event-processing cycle (An exception are the non-immediate ValueChangeEvents. These events are queued and processed later when an immediate event appears.)
Form event firing
An event is processed in the event-processing cycle, or request-response cycle. and the exact way it is processed is defined by its listeners.
Here is a simplified descriptions of the cycle (we omit here the case when there are non-immediate ValueChangeEvents in the queue):
- An event is thrown.
- All listeners catch the event.
- All error messages in the form are cleared.
- Event is processed based on the listener properties:
- Internal values in the form, the values referenced by the bindings of form components, are updated.
- Internal values are validated.
- The handle expressions of listeners are executed.
- Application events.
- View Models are merged or cleared.
- The Navigation expression is calculated.
- Components are refreshed: If a new event arises as a result, the whole processing is repeated. If no event arises, the processing continues to listener actions:
- Submit: defines if the document or to-do is submitted as part of the event handling;
- Persist: if enabled, the relevant data in the processed components is persisted as part of the event handling; unlike on submit action, if the form is used by a to-do, the to-do does not become finished; if part of a document, the document remains open; persist is performed after the merge to the screen level before the transaction is committed.
- Save action: defines if the to-do or document is saved;
- Navigation: defines the location where to navigate after the event is processed; you can navigate to a to-do or document, URL, custom application page (refer to the descriptions of the data types defined in the human.navigation.datatypes resource in the Standard Library)
Event processing cycle
The event processing and the listener actions are executed within a single database transaction so that if the processing fails at any stage, the database is rolled back to a consistent state.
Database transaction on event processing and listener actions
You can find a detailed schema of the cycle
here.
Events Listeners