Skip to main content

Handling Events

The Form renderer provides several events that you can use to enhance the interaction with forms. These events allow you to respond to various interactions and changes within your forms. Below, we'll briefly describe each event and its purpose.

onValueChange:

This event is triggered when the value of a form changes. Use it to detect and respond to user input or changes in form values.

onFormRendered:

This event is fired when a form is successfully rendered on the screen. You can use it to perform actions after the form is displayed. This event also marks the point in time when it is safe to start interacting with the form via ScriptApi.

onCompositionSaved:

This event is raised when a composition within the form is saved. Use it to capture and process saved compositions within your form.

onRequestUpdatedToken:

This event is triggered when a token expires and a new one is needed in order to complete a request (r.g.: Composition save, Multimedia upload, etc.)

onPageChanged:

This event is fired when the page within a multi-page form is changed. Utilize it to respond to page navigation events within your form.

onFormError:

This event is fired when an error occurs while retrieving forms, or when handling form data. You can use it to handle and display error messages to the user. The event that is raised contains two properties:

  • description: Contains the error description
  • errorType: Can be one of the following
    • PLATFORM_ERROR: Errors that are raised by the platform (e.g.: 404, FORM-5021, etc.)
    • SESSION_TIMEOUT: Raised when you use OAUTH for authentication, and the session expired
    • UNAUTHORIZED: Raised when you use Basic authentication and the user is not authorized
    • UNKNOWN: Raised when an unknown error occurs

NOTE The onFormError event is not raised when the form has invalid data

eventDispatched:

This event is a general-purpose event dispatcher. You can customize this event for your specific needs to dispatch custom events within your form.

info
For implementation details please refer to framework or framework-agnostic Interaction specification