Trigger an event when a component loses focus
For components that contain a value, it is possible to trigger an event when the component loses focus.
By simply adding the
EventOnBlur class to the components of your choice, you enable this feature for those components.
myTextField.customClass = "EventOnBlur".
By adding the class to a parent component, for example a DataGrid, all child components on any level will trigger the event when they lose focus.
The event that is triggered will end up in the
guiEvent function of the form. The payload will contain the following information on the event:
key: <path_to_component>, where
<path_to_component>is the path to the component. A focus lost event from a cell in a table may for instance get:
key: [mydatagrid][age]. In this case,
mydatagridis the key of the parent DataGrid,
3represents the row number (zero-based!) and
ageis the key of the column that was edited. A focus lost event from a simple textfield directly in the form may for instance get:
key: [surname], where
surnameis the key of the textfield.
Note that adding this custom class to a component only results in triggering an event when the component loses focus, so not every time its value changes. For triggering an event every time a component's value changes (for example for Checkbox components), see the next section. A combination of both these features can be imagined as well.