Form Handlers

Canvas Technology Platform provides the following event handlers to manage the Form actions:

#

Form Event Handlers

Description

1
this.fm.registerHandler(CFEC.PRE_INITIALIZE, function(fm, params)
{
	// implementation code here
	return params;
});

This event is called before the Form Manager initiates the form creation. The handler of this event is expected to return a config object. The returned object configuration is given priority over the default metadata configuration or the view mode of the form.

2


this.fm.registerHandler(CFEC.PRE_MODEL_LOAD, function(fm, params)
{
	// implementation code here
    return params; 
});

This event is called before the Form Manager makes its request for loading the model data. The handler of this method is expected to return a Boolean flag for continuing the model AJAX call or a JSON containing all the base params needed to be sent to the server.

3


this.fm.registerHandler(CFEC.POST_MODEL_LOAD,function(fm,data)
{
	// implementation code here
	return
	{
		};
});

This event is raised by the Form Manager after the successful retrieval of data server. This event can be used for massaging the received data as per the form structure. The handler returns the data in JSON format.

4


this.fm.registerHandler(CFEC.PRE_VALIDATE, function (fm, data)
{ 
	// implementation code here
   	return [true,true]; 
});

This event handler can be used to override the framework's default validation logic for validating the entire form. The handler is expected to return value in the array of Boolean (true/false) as the validation result. This point-cut is used for performing validation on conditional mandatory fields.

5


this.fm.registerHandler(CFEC.POST_VALIDATE, function(fm,config) 
{
	// implementation code here
    return config.isDefaultValid; 
});

This event handler is called after the default validation process is executed. The handler is expected to return a Boolean flag where, true is for valid and false is for invalid form.

6
this.fm.registerHandler(CFEC.POST_FORM_RENDERER, function(fm) {
	//implementation code
    return;
});
This event is triggered once the main form components are rendered and the actual DOM is ready. This event provides the place for implementation to use any API (e.g. setVisible, setEnable) to control initial settings based on any condition.