JS custom submit button

  • Last update:  2021-05-19
  • I. Overview

    1. Problem description

    If you define a custom button to implement some of your own business logic, but you also want this button to implement the submit and store operation, how to implement the FineReport submission in the custom button?


    2. Solution

    Add a click event to the custom button, and use the JS interface method provided by FineReport to implement the submit operation when the button is clicked. 

    II. Example

    1. Prepare template

    Open the built-in template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\RowForm\Simple_Row-based_Form.cpt

    Add a Button widget in cell B1, set the Button Type to "Common" and the Button Name to "Submit". As shown below:

    1.png



    2. Set click event

    Select cell B1, and add a Click event:

    2.png

     The JavaScript code is as follows:

    _g().verifyAndWriteReport();
    //Verify and submit

    The effect of this code is the same as clicking the submit button on the toolbar.


    3. Preview effect

    Save the template, click "Data Entry Preview", modify a piece of data at will, click the Submit button, and after the prompt "Success", preview the database query, you can see that the data is successfully filled in. As shown below:

    3.png

    III. Download template

    Click to download: 

    Custom_submit_button.cpt


    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