Successfully!

Error!

You are viewing 10.0 help doc. More details are displayed in the latest help doc

FR.Msg

注:以下为10.0版本文档参考

I. FR.Msg

FR has a built-in unified style message box instead of alert, confirm and prompt in Window.

II. FR.Msg.alert method

1. How to use

FR.Msg.alert(title, message, callback) , an alert box pops up.

title: the title of the dialog box; message: the details of the prompt displayed in the dialog box; callback: the method called when OK is clicked.

Note: callback is a function method, so it must be a method when writing callback.

2. Effects

For example, if you add an editing end event to a control, JS is: FR.Msg.alert("Warning", "Wrong Value "); After the editing of the control is finished, you will see the dialog box as shown below:

1.png

III. FR.Msg.confirm method

1. How to use

FR.Msg.confirm(title, message, callback, min_width) , pops up a dialog with confirm and cancel buttons.

title: the title of the dialog box; message: the details of the prompt displayed in the dialog box; callback: the method called when OK is clicked, and a parameter of the return value is obtained; min_width: indicates the minimum width.

2. Effects

If a click event is added to a delete button, the JS is: FR.Msg.confirm("Warning", "Are you sure you want to delete?"); , you will see it when you click the delete row, and you will see the following image Dialog:

2.png

Clicking OK will return true, clicking Cancel will return false, which can be obtained in the callback, but cannot be obtained directly through the function result. For example, different operations are performed through JS code to control the return value.

FR.Msg.confirm("Warning","Are you sure you want to delete?",function(value)if(value){ alert("About to be deleted!"); } else{ alert("Cancel delete!"); } },100)

A warning prompt box will pop up, click OK and it will pop up

3.png

Click Cancel to pop up

4.png

Note: You can also use the difference in the return value of confirm in Window to perform the following operations. For details, see JS implements double confirmation when deletingchapter.

IV. FR.Msg.prompt method

1. How to use

FR.Msg.prompt(title, message, value, callback, min_width) , a dialog that can pass parameters

title: the title of the dialog box;
message: the details of the prompt displayed in the dialog box;
callback: the method called when OK is clicked;
Value: the default value passed by the parameter;
min_width: the minimum width.

2. Effects

If a click event is added to a control, the JS is: FR.Msg.prompt("Enter","Hobby","Sports"); , when the control is clicked, you will see the dialog box shown below:
5.png

Note: This is just an example, the specific application can be viewed belowAssign other values to the radio button groupmethod of use in .

V. FR.Msg.toast method

1. How to use

FR.Msg.toast(message) , the long bar information that pops up from the upper right corner of the page.

message: pop-up message

2. Effects

For example, if you add a successful reporting event to a template, the JS is: FR.Msg.toast("Success"); After clicking the submit button, you will see the following dialog box pop up in the upper right corner of the page after the submission is successful:

6.png

注:以下为11.0版本文档参考

FR has a built-in unified style message box, which can replace the pop-up windows such as alert, confirm and prompt in Window.

Msg.alert

MethodFR.Msg.alert(title, message, callback)Pop up message box with only OK button
Parameter

title: String

message: String

callback: function

title: the title of the alert box

message: the prompt content displayed in the warning box

callback: function method called when OK is clicked

Return valuevoid
     Example

A message box with the title Warning and the content Wrong Value pops up:

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

A message box with the title Warning and the content Wrong Value pops up, click OK to clear the value of textEditor0 Text Widget:

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

Add theEditing End event to the Text Widget. When the length of the entered job number is not 6, a pop-up window will prompt: The job number must be 6 digits:

1.gif

   MobileSupport mobile

Msg.confirm

MethodFR.Msg.confirm(title, message, callback)A message box with confirm and cancel buttons pops up.
     Parameter

title: String

message: String

callback: function

title: dialog title

message: the prompt content displayed in the dialog box

callback: The method called when OK and Cancel are clicked, you can get a parameter value value:

  • Click OK, the value is: true

  • Click Cancel, the value is: false

Note: The value can only be obtained in the callback, and the result will not be obtained directly through FR.Msg.confirm(title, message, callback)

    Return value

    void

         Example

    A message box with the title Warning and the content Are you sure you want to delete? pops up:

    FR.Msg.confirm("Warning","Are you sure you want to delete?");

    A warning box with the title Warning and the content "Are you sure you want to delete?" pops up. When you click OK, "Delete Soon!" pops up; when you click Cancel, "Undelete!" pops up:

    FR.Msg.confirm("Warning""Are you sure you want to delete?"function(value{
    if (value == true) {
    alert("About to delete!");
    else {
    alert("Cancel delete!");
    }
    }, 100);
      Application example

    Add a click event to a delete button . When clicking delete, confirm whether to delete it:

    2.gif

       MobileSupport mobile

    Msg.prompt

    MethodFR.Msg.prompt(title, message, value, callback)Pop up a message box that can post back content
       Parameter

    title: String

    message: String

    callback: function

    Value: String

    title: the title of the dialog box
    message: the prompt content displayed in the dialog box
    callback: the method called when OK is clicked
    Value: the default return content

      Return value

      void

           Example

      A message box with the title Enter and the content Hobbypops up:

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

      A message box with the title of Enter, the content of Hobby and the default input hobby of       Sports will pop up:

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

      A message box with the title of Enter, the content of Hobbyand the default input hobby of  Sports will pop up:

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

      The title of the pop-up is Enter, the content is Hobby, and the default value is no value. After entering the value, it is passed to thetextEditor0 text box widget:

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

      Add a State Chang event to the Radio Button, when Other is selected, a message box will pop up, enter other sports items and backfill them into the cell:

      3.gif

       MobileSupport mobile

      Msg.toast

      MethodFR.Msg.toast(message)The report pops up a long message box from the upper right corner of the page
         Parameter

      message: String

      message: the content of the message box

          Return value

        void

             Example

        A long bar message with the content "Export Successful" pops up:

        FR.Msg.toast("Export Successful");
          Application example

        Add an After Exporting Excel event to the page. After exporting Excel, Export Successful pops up in the upper right corner of the page:

        4.gif


          MobileSupport mobile


        Attachment List


        Theme: 11.0 New Features
        Already the First
        Already the Last
        • Helpful
        • Not helpful
        • Only read

        Doc Feedback