Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Control object > Methods

JavaScript API: Control object > on()

Scroll Prev Next More

 

Adds an event to the control and transfer the array of arguments to the handler.

Syntax

ctrl.on(event,handler);

Arguments

event

one of the available event values.

handler

the function performed after the event was fired.

Return value

No return value.

Example

Add the 'click' event to the control using the JavaScript OnLoad event:

 

ctrl.on('click', function() {
// call the 'setValue' method to set a new value
   this.setValue('newValue');
});

See also:

JavaScript API: Control object > setValue()

JavaScript API: Control object > clearEvent()

Example: Show dropdown list of US states if US was selected in country list

Example: Ask for confirmation before saving a record

Example: Show order total on the Edit page as the details table is updated

Events: JavaScript OnLoad

JavaScript API: Control object

JavaScript API