UI Component Field events - Platform - BlueCat Gateway - 18.6.1

Gateway Administration Guide

BlueCat Gateway

There are three main events used by UI Component Fields:

  • on_complete - the field is populated and valid and you want the user to move on to the next phase
  • on_change - if the field input was modified
  • on_click (for a button) - only if the button is clicked

Use on_complete and enter a list of function names to be called on completion. For UI Component Fields you can use the format call_<name of another field component> to trigger their default Javascript.

It is possible to control the behaviour of other fields based on event triggers. The parameters listed below defines the behaviour, and accepts a dictionary as input with the key being the event to trigger the behaviour and the value being a list of fields to perform the behaviour on. There are currently three behaviours:

  • enable_dependencies - Enables all specified fields when the event is triggered.
  • disable_dependencies - Disables all specified fields when the event is triggered.
  • clear_dependencies - Clears all specified fields when the event is triggered. How this behaviour works depends on the field being cleared. For example, with SelectFields it will also clear all options on top of user input.

For disable_dependencies and clear_dependencies, there is an additional cascade mechanism specified by the should_cascade_disable_on_change and should_cascade_clear_on_change parameters respectively. The cascade mechanism work when disabling or clearing a field, if the cascade parameter is set to True, it will also disable or clear the dependents of the field specified in the disable_dependencies or clear_dependencies parameter for the on_change event.

Each UI Component Field will always generate call_<field id> and populate_<field id>: call_<field id>is responsible for field initialization; populate_<field id> is responsible for UI population from server retrieved data.

If you wish to perform additional server-side calls (for example, to retrieve more data after validation and populate other fields) you can use the following parameters:

  • server_side_output_method - the server_endpoint to be called
  • server_output - to specify for which event to trigger the server_side_output_method and to map data properties returned by server with UI HTML element names in format { <data property> : <html element id>, …}
  • validators - default WTForm validators. This is triggered to validate on form submit from the server-side.