IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Create user interfaces for business processes > Coach and Coach View reference information

Event handlers

Coach Views have predefined event handlers that perform callback functions when an event is detected. You can add your own code to these event handlers in the Behavior page of the Coach View.

When a Coach is run, the Coach Views that it contains have a lifecycle that they follow. The following table lists the stages in the lifecycle and the event handlers that are called in that stage.

Stage Event Handlers Description
1 load When the coach is run, the HTML is generated first and then the load() function is called to perform initialization logic, such as defining variables. The load() function is only called once. For composite views, during the load() call, each subview's load() is invoked before the composite view's load().
2 view After initialization is completed, the view() function is called before the user sees the view. The view() function typically performs logic to determine what a user sees when the view is rendered.

For example, you can show or hide labels depending on the visibility setting. Similar to the load() function, each subview's view() is invoked before the composite view's view()

3

change

collaboration

validation

All of the functions at this stage of the lifecycle can occur in any order and can occur multiple times.

The change() function reacts to changes in binding or configuration data.

If the change() function is not implemented, the view() function is called. The collaboration(event) function is called if it is implemented, when multiple people work on the same view at the same time. If collaboration(event) function is not implemented, the default collaboration coach view logic, which is to outline the coach view DOM node, takes effect. The validate(event) function is called when a boundary event occurs and its Fire Validation property is set to Before. The event is an error event or clear event. The validate(event) function uses the error event to decorate the Coach View to show that it has non-valid data. It uses the clear event to remove the decoration.

4 unload The unload() function is called when the Coach View is removed from the Coach.

For example, when the user deletes a Coach View inside a table row or clicks away from the page. The unload() function performs any required cleanup, and recursively invokes the unload() function on all subviews. The parent view's unload() method gets called before the child view's unload() method. The unload() function is only called once.

Coach and Coach View reference information


Related concepts:
Coach Views


Related reference:
The view object
The context object