FR.Msg

  • Last update:July 31, 2023
  • Version

    Report Server Version

    Functional Change

    11.0.10

    Optimized Msg.toast parameter format.

    11.0.7

    Added description of FVS template interface.

    Applicable to users who have installed the FVS Big Screen Edit Mode plugin of version 1.8.0 and later.

    11.0

    /

    FineReport has built-in message boxes (with a unified style) that can replace the alert, confirm, prompt, and toast pop-up boxes in Window.

    Msg.alert

    Report and Dashboard

    Method

    FR.Msg.alert(title, message, callback)

    Pop up a message box with only the OK button.

    Parameter

    title: String

    message: String

    callback: function

    title: Title of the warning box

    message: Prompt content displayed in the warning box

    callback: Function method called when OK is clicked

    Return Value

    void

    Example

    Pop up a message box with the title Warning and the content Wrong value.

    FR.Msg.alert("Warning","Wrong value");

    Pop up a message box with the title Warning and the content Wrong value. When OK is clicked, the value of textEditor0 (a Text Field widget) is cleared.

    var a = _g().getParameterContainer().getWidgetByName("textEditor0");
    FR.Msg.alert("Prompt", "Wrong value", function() {
    a.reset();
    });

    Application Example

    Add an After Exiting Edit event to the Text Field widget. If the entered employee ID does not contain six digits, a prompt pops up: Employee ID should be 6 digits.

    Mobile Terminal

    It is supported on mobile terminals.

    FVS Template

    Method

    duchamp.Msg.alert(

    {

    title:String

    message:String

    callback:function

    }

    )

    Pop up a message box with only the OK button.

    Parameter

    title:String

    message:String

    callback:function

    Title: Title of the warning box (required)

    message: Prompt content displayed in the warning box (required)

    callback: Function method called when OK is clicked  (optional)

    Return Value

    void

    Example

    Pop up a message box with the title Warning and the content Wrong value!.

    duchamp.Msg.alert({
        title:"Warning",
        message:"Wrong value!"
    });

    Pop up a message box with the title Warning and the content Wrong value. When OK is clicked, the value of the Text Box widget is cleared.

    var a = duchamp.getWidgetByName("Text Box");
    duchamp.Msg.alert({
        title:"Warning",
        message:"Wrong value!",
        callback:function(){a.reset();}
    });

    Application Example

    Click to download the template: Pop up a confirmation message box.fvs

    Mobile Terminal

    It is not supported on mobile terminals.

    Msg.confirm

    Report and Dashboard

    Method

    FR.Msg.confirm(title,   message, callback)

    Pop up a message box with OK and Cancel buttons.

    Parameter

    title: String

    message: String

    callback: function

    title: Title of the dialog box

    message: Prompt content displayed in the dialog box

    callback: Method called when OK or Cancel is clicked

    A value parameter can be obtained:

    • Click OK. value: true

    • Click Cancel. value: false

    iconNote:
    The value parameter can only be obtained in the callback parameter. The result cannot be obtained directly through FR.Msg.confirm(title, message, callback).

    Return Value

    void

    Example

    Pop up a message box   with the title Warning and the content Sure to delete?.

    FR.Msg.confirm("Warning","Sure to delete?")

    Pop up a warning box with the title Warning and the content Sure to delete?

    When OK is clicked, it prompts: Delete! 

    When Cancel is clicked, it prompts: Cancel!

    FR.Msg.confirm("Warning", "Sure to delete?", function(value) {
    if (value == true) {
    alert("Delete!");
    } else {
    alert("Cancel!");
    }
    }, 100);

    Application Example

    Add a Click event to a Delete button.

    When Delete is clicked, confirm if you want to delete.

    Mobile Terminal

    It is supported on mobile terminals.

    FVS Template

    Method

    duchamp.Msg.confirm(

    {

    title:String,

    message:String,

    callback:function

    }

    )

    Pop up a message box with OK and Cancel buttons.

    Parameter

    title:String

    message:String

    callback:function

    title: Title of the dialog box (required)

    message: Prompt content displayed in the dialog box (required)

    callback: Method called when OK or Cancel is clicked A value parameter can be obtained. (optional)

    • Click OK. value: true

    • Click Cancel. value: false

    Return Value

    void

    Example

    Pop up a message box with the title Warning and the content Sure to delete?.

    duchamp.Msg.confirm({
        title:"Warning",
        message:"Sure to delete?",
    });

    Pop up a warning box with the title Warning and the content Sure to clear?

    When OK is clicked, it prompts: Clear! 

    When Cancel is clicked, it prompts: Cancel!

    var a = duchamp.getWidgetByName("Text Box");
    duchamp.Msg.confirm({
        title:"Warning",
        message:"Sure to clear?",
        callback:function(value){
            if(value == true){
            alert("Clear!");
            a.reset();}
            else{alert("Cancel!");}
        }
    });

    Application Example

    Add a Click event to the title. In the pop-up message box, click OK to clear the text box content, and click Cancel to cancel the clearing.

    Click to download the template: Pop up a message box to confirm canceling.fvs

    Mobile Terminal

    It is not supported on mobile terminals.

    Msg.prompt

    Report and Dashboard

    Method

    FR.Msg.prompt(title, message, value, callback)

    Pop up a message box that returns content.

    Parameter

    title: String

    message: String

    callback: function

    value: String

    title: Title of the dialog box

    message: Prompt content displayed in the dialog box

    callback: Method called when OK is clicked

    value: Default return content

    Return Value

    void

    Example

    Pop up a message box with the title Enter and the content Hobby.

    FR.Msg.prompt("Enter","Hobby");

    Pop up a message box with the title Enter and the content Hobby

    The default entered hobby is Sports.

    FR.Msg.prompt("Enter","Hobby","Sports");

    Pop up a message box with the title Enter and the content Hobby

    The default is empty. 

    After you enter the content, it is passed to textEditor0 (a Text Field widget):

    var a = _g().getParameterContainer().getWidgetByName("textEditor0");
    FR.Msg.prompt("Enter", "Hobby", "",
    function(value) {
    a.setValue(value);
    }
    );

    Application Example

    Add a State Change event to Radio Button. If Others is selected, a message box pops up. After you enter another hobby, the entered content fills back to the targeted cell.

    Mobile Terminal

    It is supported on mobile terminals.

    FVS Template

    Method

    duchamp.Msg.prompt(

    {

    title:String,

    message:String,

    callback:function,

    value: String

    }

    )

    Pop up a message box that returns content.

    Parameter

    title:String

    message:String

    callback:function

    value: String

    title: Title of the dialog box (required)
    message: Prompt content displayed in the dialog box (required)
    callback: Method called when OK is clicked (optional)
    value: Default return content (optional)

    Return Value

    void

    Example

    Pop up a message box   with the title Enter and the content Hobby.

    The default is empty. 

    After you enter the content, it is passed to the Text Box widget.

    var a = duchamp.getWidgetByName("Text Box");
    duchamp.Msg.prompt({
        title:"Enter",
        message:"Hobby",
        callback:function(value){a.setValue(value);},
        //value:""
    });

    Application Example

    Click to enter a name in the pop-up message box, and then click OK to fill it back into the Text Box widget.

    Click to download template: Pop up a message box that returns content.fvs

    Mobile Terminal

    It is not supported on mobile terminals.

    Msg.toast

    Report and Dashboard

    Method

    FR.Msg.toast(message)

    Pop up a message box from the preview page.

    Parameter

    message: String

    iconNote:
    In FineReport 11.0.10 and later versions, the parameters support JSON format and a new parameter type has been added as follows.

    {

    message:String,

    type:"success"   | "info" | "warn" | "error"

    }

    message: Content in the message box

    type: Icon style on the left side of the message box (optional) 

    The default is info.

    iconNote:
    For ordinary reports (only when Engine-X is enabled), if you modify the type parameter value, the icon style changes.
    • success: 

    • info: 

    • warn: 

    • error: 

    Return Value

    void

    Example

    Pop up a long rectangular message with the content Export succeeded.

    FR.Msg.toast("Export succeeded");

    Pop up a message with a success icon and the content Export succeeded.

    FR.Msg.toast({
        message:"Export succeeded",
        type:"success"
    });

    Application Example

    1. Example of a report

    Add an After Exporting Excel event to the page. After the Excel file is exported, a message Export succeeded pops up in the upper right corner of the page.

     

    2. Example of a new adaptive dashboard

    After exporting the Excel file, a message Export succeeded pops up in the upper right corner of the page.

     

    3. Example of an old adaptive dashboard

    After exporting the Excel file, a message Export succeeded pops up in the upper right corner of the page.

    Mobile Terminal

    It is supported on mobile terminals.

    FVS Template

    Method

    duchamp.Msg.toast(

    {

    message:String,

    type:"success"   | "info" | "warn" | "error"

    }

    )

    Pop up a long rectangular message box in the upper right corner.

    Parameter

    message:String

    type:"success"   | "info" | "warn" | "error"

    message: Content in the message box (required)

    type: Icon style on the left side of the message box (optional) 

    The default is info.

    success: 

    info: 

    warn: 

    error: 

    Return Value

    void

    Example

    Pop up a rectangular message box with the content It is correct.

    duchamp.Msg.toast({
        message:"It is correct",
        type:"success"
    });


    Application Example

    Click The sun rises in the east., a prompt pops up: It is correct.

    Click The sun rises in the west., a prompt pops up: It is wrong.

    You can manually close the prompt box, or wait a few seconds for it to close automatically.

    Click to download the template: Pop up a long rectangular prompt box in the upper right corner.fvs

    Mobile Terminal

    It is not supported on mobile terminals.

     

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • 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