Edit

Share via


addEventHandler (Client API reference)

Adds an event handler for the specified event

Control types supported

Custom code components

Syntax

  const controlName1 = "cr116_personid";

  this.onLoad = function (executionContext) {
    const formContext = executionContext.getFormContext();

    const sampleControl1 = formContext.getControl(controlName1);
    sampleControl1.addEventHandler("customEvent1", this.onSampleControl1CustomEvent1);
    sampleControl1.addEventHandler("customEvent2", this.onSampleControl1CustomEvent2);
  }

Parameters

Name Type Required Description
name string yes The name of the custom event configured for the custom component.
function Function Yes The function to add to the named event. The execution context is automatically passed as the first parameter to this function.

Define Events