JS Get the Last Edited Value

  • Last update:  2020-12-30
  • 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:

    image.png

    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.

    image (3).png

    Note: The mobile terminal does not support this JS.

    III. Completed Template

    Attachment List


    Theme: Data Entry
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy