convert some tabs to spaces

This commit is contained in:
rolux 2012-07-09 16:31:04 +02:00
parent 4818a7d617
commit 3ea3600a23

View file

@ -42,42 +42,42 @@ Ox.Form = function(options, self) {
self.itemIds[i] = item.options('id') || item.id; self.itemIds[i] = item.options('id') || item.id;
self.$items[i] = Ox.FormItem({element: item}).appendTo(that); self.$items[i] = Ox.FormItem({element: item}).appendTo(that);
item.bindEvent({ item.bindEvent({
autovalidate: function(data) { autovalidate: function(data) {
validateForm(i, data.valid); validateForm(i, data.valid);
data.valid && self.$items[i].setMessage(''); data.valid && self.$items[i].setMessage('');
}, },
/* /*
// fixme: should't inputs also trigger a change event? // fixme: should't inputs also trigger a change event?
blur: function(data) { blur: function(data) {
that.triggerEvent('change', { that.triggerEvent('change', {
id: self.itemIds[i], id: self.itemIds[i],
data: data data: data
}); });
}, },
*/ */
change: function(data) { change: function(data) {
// fixme: shouldn't this be key/value instead of id/data? // fixme: shouldn't this be key/value instead of id/data?
that.triggerEvent('change', { that.triggerEvent('change', {
id: self.itemIds[i], id: self.itemIds[i],
data: data data: data
}); });
validateItem(i, function(valid) { validateItem(i, function(valid) {
validateForm(i, valid); validateForm(i, valid);
}); });
}, },
submit: function(data) { submit: function(data) {
self.formIsValid && that.submit(); self.formIsValid && that.submit();
}, },
validate: function(data) { validate: function(data) {
validateForm(i, data.valid); validateForm(i, data.valid);
// timeout needed for cases where the form is removed // timeout needed for cases where the form is removed
// from the DOM, triggering blur of an empty item - // from the DOM, triggering blur of an empty item -
// in this case, we don't want the message to appear // in this case, we don't want the message to appear
setTimeout(function() { setTimeout(function() {
self.$items[i].setMessage(data.valid ? '' : data.message); self.$items[i].setMessage(data.valid ? '' : data.message);
}, 0); }, 0);
} }
}); });
}); });
self.formIsValid = self.options.validate(self.itemIsValid); self.formIsValid = self.options.validate(self.itemIsValid);