About the form event model
There are two kinds of form events that can be generated in Mongoose-based applications:
- Standard events for forms are generated automatically as the user interacts with the client. These are typically generated by standard toolbar actions and/or by menu items.
- Custom form events can be created by application developers and generated, based on specified conditions.
By themselves, events do not perform work. They simply indicate that something specific has happened or condition has occurred. The actual response action is performed by event handlers. Event handlers define units of work (that is, responses) that are associated with a specific event type. The work is executed whenever an event of that type is generated.
Mongoose provides built-in responses for most standard form events. It also provides tools for creating custom events and event handlers. You can create custom event handlers for all standard and custom events.
There are two basic reasons that you might want to create your own event handlers:
- To handle the very simple and very common case of performing some work
based on an action by the user.
For instance, you might want to launch a form or call a method when a button is clicked. In this case, you would create a custom event associated with the button and create an event handler that performs the required work in response to the event. There are a variety of response types that can be used, including the execution of methods and scripts.
- To override the standard application behavior.
In these cases, you might want to add some processing and/or cancel the default processing that happens in response to a particular standard event. These adjustments can be easily accomplished by creating a form event handler for the standard form event.