Adds an event listener to the form
Method of Form
Syntax
Form.addEventListener( eventType, listenerFunction )
Parameters
Parameter | Description |
---|---|
eventType | A string representing the type of event after which listenerFunction will be executed. |
listenerFunction | The function that will be executed when an event of type eventType is fired; this function may have at most one parameter, corresponding to the event that caused it to execute. |
Description
This method adds an event listener that executes when a form event of a particular type is fired. The listener may accept the event as a parameter. When an event is fired, the listener will be executed and this parameter will be set to reference a FormEvent object.
Event listeners should be used in accordance with the MetaScript 2.0 MetaScript calculation model.
Example
The following example uses addEventListener to populate a 'customer_list' dynamic popup on a Jobs form with all customers whose names begin with the letter entered in the 'customer_index' field.