Verify Closing of Modal #180

Closed
sgsweb opened this Issue May 29, 2012 · 1 comment

Projects

None yet

2 participants

@sgsweb
sgsweb commented May 29, 2012

When the user closes the modal using escape key, clicking outside the modal, or clicking the X, I like to popup another modal to ask them if they are sure. Similar to a confirm javascript api. The problem is that there is no way to prevent a closing using the beforeClose callback. That is, I cannot send back a false from the beforeClose callback to prevent the closing of the modal. What is the best method for doing this?

sgs.

@nyroDev
Owner
nyroDev commented Oct 16, 2014

See commits d42cd1f and 6fc3232

You'll be able to do something like:

$.nmFilters({
    custom: {
        close: function(nm) {
            if (!nm._confirmClosed) {
                if (confirm('Are you sure you want to close it?')) {
                    nm._confirmClosed = true;
                    nm.close();
                }
                return false;
            }
        }
    }
});
@nyroDev nyroDev closed this Oct 16, 2014
@nyroDev nyroDev added the tips label Oct 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment