fix a bug in Ox.Input that would make its change event fire more than once
This commit is contained in:
parent
923ed92bd7
commit
8de69b3173
1 changed files with 13 additions and 1 deletions
|
@ -596,6 +596,15 @@ Ox.Input = function(options, self) {
|
||||||
self.options.placeholder && setPlaceholder();
|
self.options.placeholder && setPlaceholder();
|
||||||
self.options.validate && validate();
|
self.options.validate && validate();
|
||||||
self.bindKeyboard && Ox.UI.$document.unbind('keydown', keydown);
|
self.bindKeyboard && Ox.UI.$document.unbind('keydown', keydown);
|
||||||
|
if (!self.cancelled && !self.submitted) {
|
||||||
|
that.triggerEvent('blur', {
|
||||||
|
value: self.options.value
|
||||||
|
});
|
||||||
|
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
||||||
|
value: self.options.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/*
|
||||||
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
||||||
value: self.options.value
|
value: self.options.value
|
||||||
});
|
});
|
||||||
|
@ -604,17 +613,20 @@ Ox.Input = function(options, self) {
|
||||||
!self.cancelled && !self.submitted && that.triggerEvent('blur', {
|
!self.cancelled && !self.submitted && that.triggerEvent('blur', {
|
||||||
value: self.options.value
|
value: self.options.value
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
self.cancelled = true;
|
self.cancelled = true;
|
||||||
self.$input.blur().val(self.originalValue);
|
self.$input.val(self.originalValue).blur();
|
||||||
self.cancelled = false;
|
self.cancelled = false;
|
||||||
that.triggerEvent('cancel');
|
that.triggerEvent('cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
function change() {
|
function change() {
|
||||||
|
// change gets invoked before blur
|
||||||
self.options.value = self.$input.val();
|
self.options.value = self.$input.val();
|
||||||
|
self.originalValue = self.options.value;
|
||||||
that.triggerEvent('change', {
|
that.triggerEvent('change', {
|
||||||
value: self.options.value
|
value: self.options.value
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue