monster.ui.confirm()#

The monster.ui.confirm() method generates a dialog window giving the user the choice to confirm or cancel an action.

Syntax#

monster.ui.confirm(content[, callbackOk, callbackCancel, options]);

Parameters#

content: String (mandatory)#

Text that will be displayed inside the generate dialog window.

callbackOk: Function (optional)#

Function executed when the user click on the ok button. If not specified, clicking on the ok button will only close the dialog window.

callbackCancel: Function (optional)#

Function executed when the user click on the cancel button. If not specified, clicking on the cancel button will only close the dialog window.

options: Object (optional)#

Let you override default options that can be found on the jQuery UI Dialog Widget page. The only options that cannot be overridden are show, hide and the close method.

Return#

This method returns the generated dialog window as a jQuery object.

Description#

The dialog window generated by the monster.ui.confirm() function contains a bar with the title "Confirmation" by default, a section to display the string passed as the content parameter and two buttons to confirm or cancel the action that opened the dialog window.

This method is calling monster.ui.dialog() using a specific template to build the dialog window.

The goal of this method is to display basic confirmation dialog window to the user when a critical action is triggered.

Examples#

  • Create a confirm dialog window with a callback on success
clickLogout: function() {
    var self = this;

    monster.ui.confirm(self.i18n.active().confirmLogout, function() {
        self.logout();
    });
},
logout: function() {...}

To create the confirm dialog window, just call the method and indicate the string to display to the user.

Confirm dialog window

Edit this page here