Skip to content
Browse files

Merge branch 'master' of git@github.com:winton/stutools

  • Loading branch information...
2 parents 066e187 + 3d82018 commit a1fc104356020661ec2b908d13e80d8ee7378c2a Winton Welsh committed Apr 28, 2008
Showing with 12 additions and 6 deletions.
  1. +12 −6 Dialog.js
View
18 Dialog.js
@@ -70,30 +70,31 @@ Example:
*/
var Dialog = Base.extend({
- elements: {
- load: {}, container: {}, dialog: { close: '.close', form: 'form', submit: '.submit' }
- },
options: {
elements: {}, events: {},
onShow: Class.empty, // must call dialog.show(), this.ready()
onHide: Class.empty,
onSubmit: Class.empty,
- onRespond: Class.empty,
+ onRespond: Class.empty,
onValidationFailed: Class.empty,
onValidationReset: Class.empty,
centered: false,
lightbox: false,
- inside: null,
+ inside: null,
trigger: null,
dialog_template: '#template_dialog',
method: 'post'
},
initialize: function(template, options) {
+ this.elements = {
+ load: {}, container: {}, dialog: { close: '.close', form: 'form', submit: '.submit' }
+ };
+
this.options.trigger = '#' + template;
this.elements.load.template = '#template_' + template;
this.elements.load.dialog_template = this.options.dialog_template;
@@ -121,7 +122,7 @@ var Dialog = Base.extend({
this.hide();
},
onFormKeyDown: function(e) {
- if (e.key == 'esc') this.hide();
+ if (e.key == 'esc') this.hide();
if (e.key == 'enter' && e.target.tagName != 'TEXTAREA') this.submit(e);
},
onFormSubmit: function(e) {
@@ -210,6 +211,11 @@ var Dialog = Base.extend({
return this;
},
+ reset: function() {
+ this.el.form.reset();
+ $ES('input, textarea', this.el.form).each(function(item) { this.fireEvent('onValidationReset', item); }, this);
+ },
+
resize: function() {
if (!this.el.dialog) return false;
if (this.el.dialog && this.el.dialog.visible())

0 comments on commit a1fc104

Please sign in to comment.
Something went wrong with that request. Please try again.