Versions Compared

Key

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

...

#

Form Event Handlers

Description

1

fm.addCssClass(fieldNames, clsName, index, parent)

Adds any component-related CSS classes under the Form Manager.

2

fm.addForm(String formId, [mode:<'edit'||'view'>],[direction:<'TOP' || 'BOTTOM'>])

Allows to add a sub-form within a form on the fly.

3

fm.addNext(String formId)

Adds a form in the multiform next to the available instance.

4

fm.applyModelData(obj, ignoreChanges)

Applies the changes made in the model data for the specific fields and then ignores the changes in the remaining fields.

5

fm.clearInvalid(fieldName, index, parent)

Clears the values from the given invalid form item. The second and third parameters are required in case of a multiform only, where index of the multiform at which the field is present must be the second parameter, and the multiform ID must be the third parameter.

6

fm.clearUploadPanel(fieldNames)

Resets the files inside the panel upload components that exist in the form with respect to array of file names.

7

fm.clearValues(fieldNames)

Clears the value of a specific form fields.

8

fm.exportForForms(exportType, title)

Exports the form content for printing or PDF conversion. It currently supports two export types – PDF and HTML.

9

fm.focus(fieldName, index, parent)

Sets the focus to the given form item. The second and third parameters are required for multiform only, where the index of the multiform at which the field is present must be the second parameter, and the multiform ID must be the third parameter.

10

fm.getDropDownDisplayValue(fieldName, keyValue, index, parent)

Returns the display value for the corresponding key value of a drop-down. This is applicable for drop-downs only. In case of multiform, the third and fourth parameters are necessary. The index of the multiform at which the drop-down is present should be the third parameter. The multiform ID must be the fourth parameter.

11

fm.getForm()

Returns the DOM object of the form.

12

fm.getFormTitle(String formId)

Returns the title as per the metadata of the request Master Form ID.

13

fm.getFormView()

Returns the reference of the wrapper panel under which the entire form is rendered. The app layer requires this view where it wants to render the form. This in turn helps the Form Manager to prepare the configurations for Lazzy Loading of the form components.

14

fm.getModelData()

Returns the form model data of the form items.

15

fm.getNumberOfSubForms(String formId)

Returns the number of instances or replica of the multiform is available in the screen.

16

fm.handlerEvent(event, fieldName, value, index, parent)

Raises any event dynamically.

17

fm.isFieldValid(fieldName)

Validates a specific sub-form, such as in Tab Panels. It returns true if the sub-form is valid, else returns false.

18

fm.isFormDataChanged

Returns true or false to indicate whether the data displayed on the form is changed or not.

19

fm.isFormValid()

Validates all the fields in the form. It first looks up for custom form validation provided by the app layer. You can execute it in case it is provided, otherwise use the default validation process. Then, you can execute the post default validation process in case it is registered. This returns true if the form is valid, else returns false.

20

fm.isTabFormValid()

Validates all the fields in the form by invoking the validateTabForm() method. It returns true if the form is valid, else returns false.

21

fm.isTabPanelExists()

Checks if the Tab Panel exists or not in the whole form. This method is included because when adding the form using the addform() method in the Form Manager instance, the form loses its padding when Tab Panel is rendered already. It returns true if the Tab Panel exists in the form, else returns false.

22

fm.isUploadPanelValid()

Validates the file upload component. If the component is mandatory and if the file queue is empty, then the component is validated. It returns true if the file upload panel is valid, else returns false.

23

fm.markInvalid(fieldName, msgKey)

Marks the field as invalid with the given message.
The message should be added in the bundle key associated with the form or form item.

24

fm.registerHandler(event, fieldName, handler, scope)

Event handlers for all form components have to be registered to the Form Manager using this method. This method updates the handler in the local register object to be used later when receiving the events from the model. This method requires the event for which the handler needs to be registered as the first parameter; Item ID of the component for which the event needs to be registered as the second parameter; the call back function that needs to be executed for the passed event as the third parameter; and finally the scope in which the handler needs to be executed as the fourth parameter.

25

fm.reloadData(fieldName)

Loads the app item with the recent data values.

26

fm.removeAt(String formIndex, String formId)

Removes the multiform instance of a particular index.

27

fm.removeForm(String formId)

Removes the sub-form from the main form.

28

fm.removeFrom(String formId, String StartingIndex, String EndingIndex)

Removes the multiform instances starting from a particular index onwards up to the ending index.

29

fm.reset()

Resets the values of the fields in the form. This method can be added in the click event of the Clear or Reset button of the form.

30

fm.resetSubForms()

Resets all the sub forms. It can be used to reset the sub form on click of the Reset button.

31

fm.resetUploadPanel()

Resets the files added in the upload component.

32

fm.setAllowBlank(fieldName, validation)

Sets a specific field to be blank irrespective of whether it is defined as a mandatory field or not. The validation parameter must be a Boolean value – true or false.

33

fm.setDecimalPrecision(fieldName, keyValue)

Sets the decimal precision for the spinner field. This needs to be implemented if the spinner field is part of a multiform.

34

fm.setDefaultValue(fieldName, keyValue, index, parent)

Sets the decimal value for the spinner field. This is applicable for the spinner field only. This method takes the following four parameters – the Item ID of the spinner field, the decimal value the needs to be set, the index of the multiform at which the spinner is present if at all the spinner is part of the multiform, and the multiform ID. The third and fourth parameters are applicable in case of multiform only.

35

fm.setDisabledDates(fieldName, disabledDates, disabledDatesText)

Disables the given dates in the given date field. When the user selects the disabled date, the text given as disabled text is displayed.

36

fm.setDisabledDatesText(fieldName, disabledDatesText)

Shows the given string when the user selects the disabled date on the given date control.

37

fm.setEnabledFields(fieldName1, fieldName2..., showFlag)

Enables or disables the form items based on the showFlag value.

38

fm.setFocus(fieldName)

Sets the focus on a specific field. It returns the JSON of the field name that is passed and its valid status.

39

fm.setMaxValue(fieldName, keyValue, index, parent)

Sets the maximum value for the date field or spinner field. For the date field, the value must be in the DD/MM/YYYY format. The third and fourth parameters are required in case of a multiform only, where index of the multiform at which the date or spinner field is present and parent is the multiform ID.

40

fm.setMinValue(fieldName, keyValue, index, parent)

Sets the minimum value for the date field or spinner field. For the date field, the value must be in the DD/MM/YYYY format. The third and fourth parameters are required in case of a multiform only, where index of the multiform at which the date or spinner field is present and parent is the multiform ID.

41

fm.setVisibleFields(fieldName1, fieldName2..., showFlag)

Shows or hides the form items based on the showFlag value.

42

fm.updateComboRawStore(fieldName, keyArray, valueArray, index, parent)

Updates the given combo item with the given array of keys and array of values. It is applicable for drop-downs, item selector, icon combo, auto suggest, and image panels only. For image panel, the keys must be the IDs of the images and the values must be the source (src) of the images. The fourth and fifth parameters are required in case of multiform only, where index of the multiform at which the field is present is the fourth parameter and multiform ID is the fifth parameter.

43

fm.uploadFile(String state, handler)

Uploads the file in queue state and call backs the appropriate handler invoked by the developer to update the status.

44

fm.validateFields(fieldName)

Validates a specific field. It returns true if the field is valid, else returns false.

45

fm.reloadItemData(fieldValueList, index, formId)
fieldvalueList – This parameter is applicable for single and multi forms. Filter conditions can be given as follows:

Code Block
languagejs
canvas.form.listeners.TestAddBeneficiaryAdd = Class(canvas.Observable, 
{ 
	constructor: function(config) 
	{ 
		this.fm = config.fm; 
	}, 
	registerHandlers: function()
	{ 
	this.fm.registerHandler("cbxchange","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.TestAddBeneficiaryAdd); 


Index and formId – These parameters are applicable for multiforms. These two parameters must be provided along with the fieldvalueList.

Auto-populates the dependent field's values based on the values selected in the independent fields. For more information, refer Auto-populating Dependent Fields’ Values in Forms.

Note

This API can only be used when the View ID is specified for the form item. The API does not apply when the raw keys: raw values are specified or when the data for the form item is being fetched through data support class.