Using Components > Writing change handler functions for components |  |

Writing change handler functions for components

All components have a Change Handler parameter for specifying a change handler function that is called when the user selects a menu item, a radio button, or a check box. The Click Handler parameter for the PushButton component is equivalent to the Change Handler parameter. Specifying a function for the Change Handler parameter is optional. Using this function depends on the requirements and layout of your form or user interface, and the purpose of the component.

You can write Change Handler and Click Handler functions in a variety of ways. It is good coding practice to create a single handler function that specifies the actions for the components in your document, and then use the name of this handler function as the Change Handler parameter for the components. This ensures that conflicting actions are not assigned, and makes it easier to update and change the code. A Change Handler or Click Handler function always accepts at least one parameter, which is the instance of the component that has changed.