Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following diagram illustrates the form data submission flow:

Image Modified

...

Creating JS listener class for the Form

When a form or form item action is triggered by the handlers, Canvas executes its corresponding actions registered with the global form listener key CFLR. This provides the freedom to the developer to write their action logic anywhere within their application.

...

Code Block
languagejs
canvas.ns("namespace idID");

<namespace listenerClassID>.sampleListener = Class(canvas.Observable, 
{
    	constructor: function(config) 
	{ },
	
	//Inside the following function, listeners related to all form components are registered.
        this.fm = config.fm;
    },
    
	registerHandlers: function() 
	{
		this.fm.registerHandler(CFEC.PRE_INITIALIZE, function(fm) 
		{
		//Form Listener 
		});
		
		//this.fm.registerHandler(CFEC.PREPOST_MODELFORM_LOADRENDERER, function (fm,) record)
		{
		
	    }); 

		//Form Item Listener 
		// this.fm.registerHandler(CFEC.DATE_CLEAR, "<FORM_DATEFIELD_ID>"PRE_MODEL_LOAD, function (fm, event, fieldName, value)record) 
		{
        
      	}); 
	}
});

CFLR.registerListener("FORM<FORM_IDID>", <namespace listenerClassID>.sampleListener);


//* Form Container Action button listener
CABR.registerHandler('ACTION_BUTTON_ID','CONTAINER_ID', function (config)
{  }); 
*/

Create a listener payments.intertransfer.js as follows:

Code Block
languagejs
canvas.ns("payments");

payments.paymentForm = Class(canvas.Observable,
{ 
	constructor : function (config)
	{
		this.fm = config.fm;
	}, 

	registerHandlers: function()
	{ }

});

CFLR.registerListener("PAYMENT_FORM", canvas.form.listenerspayments.paymentForm); 

CABR.registerHandler('SUBMIT','PAYMENTS_CONTAINER', function (config)
{
	//Form submit action goes here
}); 

CABR.registerHandler('CLOSE','PAYMENTS_CONTAINER', function (config)
{
	CBXFORMCONTAINER.getActiveFormContainer().close();
});

...