|Manuals

on

Description

Allows you to add an event handler to a specific node. This method enables binding event handlers to elements in the remote object model.

Syntax

JsRO.on(object, event, handler);

Parameters

Parameter Type Description
object String Node path as a string
event String Event name as a string
handler Function Callback function to execute when the event fires

Return Value

Type Description
Boolean true if the event was added successfully, false if it was not

Remarks

The on method supports two types of events:

  • Local events (client-side): Use the model: prefix to listen for local property changes
  • Remote events (server-declared): Use the object path directly for events declared on the server

Examples

Local Event (Client-Side)

Listen for property changes on the client side:

JsRO.on('model:Form1.checkBox1', 'changed', function(elem) {
    console.log('Checkbox value changed');
    console.log('New value: ' + elem.value);
});

Remote Event (Server-Declared)

Listen for events declared on the server:

JsRO.on('Form1.checkBox1', 'click', function(elem) {
    console.log('Checkbox was clicked');
});

Button Click Handler

JsRO.on('Form1.button1', 'click', function(elem) {
    console.log('Button clicked');
    // Perform action
});

See Also