JS Remove the Prompt Box of Data Validation

  • Last update:  2020-12-30
  • I. Overview

    1.1 Problem description

    When data verification is performed on the form, a verification error prompt box will pop up, as shown in the following figure:

    Snag_588b212.png

    However, sometimes users only want to know the location of the error and do not need the prompt box, because too much prompt information will obscure the main body of the form. Results as shown below:

    Snag_588c481.png

     

    1.2 Solutions

    Do not use the built-in data validation button and submit button, and instead, customize a submit button and add JavaScript events. When submitting, if the verification fails, the cell with error is marked, and data are not allowed to be entered to the database; if the verification is successful, data can be submitted to the database.

    II. Example

    2.1 Prepare template

    Open %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Basic Data Entry.cpt


    2.2 Custom submit button

    1) In the designer menu bar, click Template > Web Attributes and select the Data Entry Settings in the opened interface. Check Individually set for the template and double-click the custom button to add it to the top toolbar. As shown below:

    Snag_58474de.png

    2) Double-click the custom button to edit it. Change Widget Alias to Submit (without prompt) and click the User Defined Event button. As shown below:

    Snag_585c8c5.png

    3) Add JavaScript code to the event editing interface, as shown below:

    Snag_5865c89.png

    The JavaScript code is as follows:

    contentPane.verifyAndWriteReport();//Perform data verification and submit data
    $('.verify-error-container').hide();//Hide prompt box

    Note: If the template is embedded in an iframe, the button outside the report needs to implement this function. The JavaScript code is as follows:

    contentPane.verifyAndWriteReport();//Perform data verification and submit data
    $("#id").contents().find(".verify-error-container").hide();//id is the id value of the corresponding iframe


    2.3 Preview effect

    Save the report and click Data Entry Preview. Click the custom submit button, and the effect is shown in the following figure:

    89A1CFBB-CD9F-4025-B084-4544904DE6E8.GIF

    Note: Mobile terminal is not supported.

    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