Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

File dialogs cancel event #292

Closed
rumax opened this Issue · 2 comments

3 participants

@rumax

Is there a way to detect "Cancel" button event in file dialog?

var chooserEntered = function() {
//do some staff. Ok
};
var chooserCanceled = function() {
//do some staff. How to call???
}

var chooser = $('');
chooser.change(function(e) {
console.log(chooser.val());
chooserEntered(chooser.val());
});
chooser.click();

@rumax

One more issue:

  • Focus is lost from currently active element (document.activeElement is set to body after fileDialog closed)
@kochelmonster

This is a hack but works:
before opening the dialog, you have to change the input's value like
$("#file-dialog")[0].files.append(new File("", ""))
When the user cancels the dialog, $("#file-dialog").val() is empty

@tommoor tommoor closed this
@exos exos referenced this issue from a commit in exos/node-webkit-fdialogs
@exos exos Add hack for detect cancel action.
The hack is taken of: nwjs/nw.js#292

Thanks sompylasar https://github.com/sompylasar
4ba597c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.