confirm

Ui

Displays a confirmation dialog in the page. The confirmation dialog contains the following,

  1. Text message
  2. Set of buttons for confirmation options. By default two buttons display - Yes and No.

When the user taps on any of the buttons, the dialog dismisses and the callback function, if provided is invoked with button index as parameter.

$m.confirm({

"title":title,

        "message": message,

        "buttons": [{"label": "Yes"},

                {"label": "May be"},

                {"label": "No"}]

}, function(index) {

        var options = ["Yes", "May be", "No"];

                $m.toast("You tapped on " + options[index]);

});

Syntax

        $m.confirm(confirmOptions [, fp_callback])

Parameters

confirmOptions

object(required)

Configuration options for the confirm dialog, which contains one or more of the following properties,

  1. message - {optional. String}. Message to display in the dialog.
  2. title - {optional. String}. The text to be shown as title to the confirm dialog. Supported in Android and Windows only.
  3. buttons - {Optional. Array}. Array of button objects to display. Each button object should have a label property. A sample buttons array looks as follows,
  1. var buttonsArray = [ {"label" : "Yes"}, {"label": "May be"}, {"label" : "No"}];

There can be a maximum of three buttons and minimum of two buttons. Defaults to array containing "Yes" and "No".