I. Overview
1.1 Requirement
When the value of a certain widget has been edited, dynamically assign values to other cells or other widgets, as shown below.
1.2 Solution
Use JS to dynamically assign values to other cells or other widgets when certain widgets have been edited.
Use contentPane.setCellValue([reportIndex], columnIndex, rowIndex, cv); or contentPane.setCellValue (“cell”, null, cv) to assign values both to cells and widgets.
Use reportIndex to specify the sheet where cells or widgets are located, starting from0.
Use columnIndex to specify the column where cells or widgets are located, starting from 0.
Use rowIndex to specify the row where cells or widgets are located, starting from 0.
Use cv to represent the values to be assigned to cells or widgets.
Example:
contentPane.setCellValue(1,2,3,"abc");
It represents that C4 in the 4th row of the 3rd column of sheet 2 is assigned the value of abc.
II. Sample
2.1 Steps
1) The report is designed as follows:
2)Select the name widget and add an [After Editing] Event:
Input the JS code:
var a = this.getValue();
contentPane.setCellValue(0, 0, a + "`s Personal Information Registration Form");
contentPane.setCellValue("B3", null, "Male");
When a certain widget has been edited, you can dynamically assign values to other cells or widgets. You are allowed to assign fixed values or assign current widget values to previous values. The textbox widget used in this sample can also be replaced with widgets of other types.
2.2 Effect preview
Save the template and select [Data Entry Preview]. The preview effect on a PC is shown as below: