# Trigger an event when a component's value changes

Components that contain a value can trigger an event whenever that value changes by using the following command on them:

obj.addCustomProperty("triggerHappy", true);

obj.properties = {"triggerHappy": True}


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:

• action: "event"
• event: "change"
• key: key of the component whose value has changed.

Note that using this option causes the component to trigger an event for every value change. This is convenient for checkboxes and similar components. However, for example for TextField components, an event will be triggered after every keystroke. In order to only trigger an event when the user is done editing a field, it is advised to use the EventOnBlur option for components with entered text. Unlike that feature, this option does not apply to child components.