Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify Closing of Modal #180

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

Verify Closing of Modal #180

sgsweb opened this issue May 29, 2012 · 1 comment
Labels

Comments

@sgsweb
Copy link

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
Copy link
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 as completed 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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants