Search and Top Navigation
#3239 closed bug (wontfix)
Opened August 21, 2008 01:52AM UTC
Closed September 02, 2008 11:38PM UTC
Last modified October 11, 2012 09:15PM UTC
Unable to cancel click event on buttons created in dialog
| Reported by: | tom | Owned by: | scottgonzalez | 
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | ui.dialog | Version: | 1.6b | 
| Keywords: | Cc: | ||
| Blocked by: | Blocking: | 
Description
In the createButtons function of ui.dialog, the click handler for the created button is as follows:
$.each(buttons, function(name, fn) {
  $('<button/>')
    .text(name)
    .click(function() { fn.apply(self.element[0], arguments); })
    .appendTo(uiDialogButtonPane);
});
I suggest modifying the handler to return the value returned from the user function, allowing the cancellation of the event, as follows:
$.each(buttons, function(name, fn) {
  $('<button/>')
    .text(name)
    .click(function() { return fn.apply(self.element[0], arguments); })
    .appendTo(uiDialogButtonPane);
});
What is the use case for canceling the click event of a dialog button?