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
: (Buttons) 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.If
should_cascade_disable_on_change
is also True, BlueCat Gateway also disables dependents of the fieldclear_dependencies
: Clears all specified fields when the event is triggered. How this behavior works depends on the field being cleared. For example, withSelectFields
it will clears all options on top of user input.If
should_cascade_clear_on_change
is also True, BlueCat Gateway also clears dependents of the field
Each UI Component Field will always generate call_<field id>
and
populate_<field id>
call_<field id>
is responsible for field initializationpopulate_<field id>
is responsible for UI population from server retrieved data.
If you want 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
: Theserver_endpoint
to be calledserver_output
: Use to specify which event triggers theserver_side_output_method
and to map data properties returned by server with UI HTML element names, using the format:{ <data property> : <html element id>, ...}
validators
: Default WTForm validators. This is triggered to validate on form submit from the server-side.