Form dialog UI: Support on cancel action

If args.cancel is passed to createForm widget, call it when cancel button is
clicked.

Example:

createForm: {
    cancel: function() { ... },
    ...
}
This commit is contained in:
Brian Federle 2014-02-13 14:33:53 -08:00
parent 8e4d020cf8
commit 0ea93d6904
1 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,7 @@
* Dialog with form
*/
createForm: function(args) {
var cancel = args.cancel;
var $formContainer = $('<div>').addClass('form-container');
var $form = $('<form>').appendTo($formContainer)
.submit(function() {
@ -113,6 +114,10 @@
$(this).dialog('destroy');
$('.hovered-elem').hide();
if (cancel) {
cancel();
}
}
}]
}).closest('.ui-dialog').overlay();