I. Overview
1.1 Problem description
Sometimes report users want to get the last edited value for verification or other operations.
1.2 Implementation ideas
The editable cell corresponds to an input element. When the focus is on a cell, the input element corresponds to a element, so to get the value in the cell, we only need to get this element and extract the value attribute.
Note: This solution is not suitable for reports with parameter widgets.
II. Example
2.1 Operation steps
1) Create a new form, and the report design is as follows:
Set the widget type of cell B1 and B2 to Text Field, and the widget type of cell B3 to Number.
2) Click Template > Web Attributes > Data Entry Settings, and add a custom button, as shown below:
3) Add the following JS to the custom button:
The specific JS code is as follows:
var lasteditValue = $("input:text").attr("value"); //Get the value of the last edited cell
if(lasteditValue> 100 || lasteditValue <1){
alert("Age is wrong!");
}
2.2 Preview effect
Save the template, select Data Entry Preview, and enter some values in turn. After entering the last cell, do not click other cells, and directly click the custom button. You can see that the last cell is verified.
Note: The mobile terminal does not support this JS.