canvas.ns("canvas.form.listeners");
canvas.form.listeners.formComponents = Class(canvas.Observable,
{
constructor: function(config)
{
this.fm = config.fm;
},
registerHandlers: function()
{
this.fm.registerHandler(CFEC.POST_FORM_RENDERER, function(fm, event, fieldName,value)
{
ctcanvas.MessageBus.subscribe('BENEFICIARY_SELECTED', "NAMESPACE", '', function(data, eventName)
/* ctcanvas.MessageBus.subscribe is the function to subscribe for broadcast events of other apps.
* Here, the Beneficiary Details Form app is subscribing to the ‘BENEFICIARY_SELECTED’
* broadcast event from Beneficiary Details app. The data received from broadcast event
* is populated to the fields on the Beneficiary Details Form app. */
{
/* The data received from broadcast event is populated to the fields on
* the Beneficiary Details Form app. */
fm.model.setValue(['BENE_NAME'],data.BENE_NAME);
fm.model.setValue(['BENE_ACC_NO'],data.BENE_ACC_NO);
fm.model.setValue(['BANK_NAME'],data.BANK_NAME);
fm.model.setValue(['BBRANCHBRANCH_NAME'],data.BRANCH_NAME);
fm.model.setValue(['PAYMENT_TYPE'],data.PAYMENT_TYPE);
});
});
}
});
CFLR.registerListener("TEST_INTERAPPBENE_DETAILS_FORM_APP", canvas.form.listeners.formComponents); |