Form Item Handlers

Canvas provides the following event handlers to manage the Form Item actions.

#

Form Item Handlers

Description

1

CHANGE

Syntax:

this.fm.registerHandler(CFEC.CHANGE,"<FORM_ITEM_ID>", 
function(fm, event, fieldName, value)
{
  //Developer to perform operations here. 
});

This event handler is executed every time its associated field value gets changed.

2

CLICK

Syntax:

this.fm.registerHandler(CFEC.CLICK, "<FORM_BUTTON/HYPERLINK_ID>", 
function(fm, event,fieldName) 
{
   //Developer to perform operations here. 
});

This event is raised on click event of the button or hyperlink item.

3

AFTER_SELECT

Syntax:

this.fm.registerHandler(CFEC.AFTER_SELECT, "<LOOKUP_ID>", 
function(fm, event, fieldName, value) 
{
   //Developer to perform operations here. 
});

This event is raised for the Lookup items when the user selects a record within the data list presented in the pop-up.
The component sends the selected record JSON object for the app layer to extract the data needed for populating the related fields.

4

BEFORE_LOAD

Syntax:

this.fm.registerHandler(CFEC.BEFORE_LOAD, "<LOOKUP_ID>", 
function(fm, event, fieldName) 
{
   //Developer to perform operations here. 
   //return parameters
});

This event is raised by the lookup before it creates its data load request. The app layer is expected to return a param JSON that is attached to override the existing base params of the lookup.

5

CLEAR_LOOKUP

Syntax:

this.fm.registerHandler(CFEC.CLEAR_LOOKUP, "<LOOKUP_ID>", 
function(fm, event, fieldName, value) 
{ 
   //Developer to perform operations here. 
});

This event is fired when the lookup item is cleared.

6

DATE_CLEAR

Syntax:

this.fm.registerHandler(CFEC.DATE_CLEAR, "<FORM_DATEFIELD_ID>", 
function(fm, event, fieldName, value) 
{
   //Developer to perform operations here. 
});

This event is fired when the date field of a form is cleared.

7

VALIDATE

Syntax:

this.fm.registerHandler(CFEC.VALIDATE, "<FORM_ITEM_ID>",
 function(fm, event, fieldName, value) 
{ 
   //Developer to perform operations here. 
});

This event handler is fired every time its associated field value changes before its value is set to the model for update. The handler is expected to invalidate the field if necessary and return true or false. In case of false, the model data is not updated with the same value.

8

BEFORE_TAB_CHANGE

Syntax:

this.fm.registerHandler(CFEC.BEFORE_TAB_CHANGE, "<FORM_ITEM_ID>", 
function(fm, event, fieldName, value) 
{ 
   //Developer to perform operations here. 
});

This event is fired by the Tab Panel when the user tries to switch between two tabs. The handler is expected to return Boolean value to allow or stop the switch.

9

VALUE_CHANGE

Syntax:

this.fm.registerHandler(CFEC.VALUE_CHANGE, "FORM_ITEM_ID", 
function(fm, event, fieldName, value) 
{
   fm.model.setValue('FORM_ITEM_ID', value.toUpperCase()); 
});

This event handler is fired to capture and raise the event when the user is changing/entering the value in the field.
The code provided on the left column is for a scenario when the developers want to change the text case as it is being typed from lowercase to uppercase.