Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replaced 'cbxchange' with Canvas Constant.

...

  1. Create a form, for example, BENE_DETAILS_ID.
  2. In BENE_DETAILS_ID form, create two combo fields for Bank Name and Branch Name.
    Image Removed
    Image Added

  3. In the Settings window of the Bank Name and Branch Name fields, mention the VIEW ID as BENE_VIEW.
    Image Removed
    Image Added
    Image Removed
    Image Added

  4. In the Settings window of the Bank Name and Branch Name fields, mention the column names BANK_NAME (in the Key Column and Value Column) and BRANCH_NAME (in the Key Column and Value Column), respectively. The column names must match with the names provided in the database.
    Image Removed
    Image Added
    Image Removed
    Image Added

  5. In the listener JS file, use the fm.reloadItemData API to link both the fields and auto-populate the value in the Branch Name field. Sample code is as follows:

Code Block
languagejava
canvas.form.listeners.BeneficiaryAdd = Class(canvas.Observable,
{
	constructor: function(config) 
	{
		this.fm = config.fm;
	},
	
	registerHandlers: function() 
	{
		this.fm.registerHandler("cbxchange"CFEC.CHANGE, "Bank_Name_ID", 
		function(fm, event, fieldName, value) 
		{
			if (!canvas.isEmpty(value)) 
			{
				this.fm.reloadItemData([
				{
					itemId : 'Branch_Name_ID', 
					filters : 
					{ 
						BANK_NAME : [value] 
					} 
				}]); 
			}
		});
	}
});
CFLR.registerListener("BENE_DETAILS_ID",canvas.form.listeners.BeneficiaryAdd); 

// Here, Bank_Name_ID is the form item ID for the Bank Name field. 
// Branch_Name_ID is the form item ID for the Branch Name Field. 
// BENE_DETAILS_ID is the form ID.
// itemId and filters are the filter conditions. 
// In this code, the Branch Name field value is being filtered based on the Bank Name. 

...