in input, trigger change on clear if changeonkeypress is true

This commit is contained in:
rlx 2011-09-01 07:43:03 +00:00
parent 6da40d325c
commit 3a87e8eb5f

View file

@ -592,14 +592,19 @@ Ox.Input = function(options, self) {
function clear() { function clear() {
// fixme: set to min, not zero // fixme: set to min, not zero
// fixme: make this work for password // fixme: make this work for password
var value = ''; self.options.value = '';
if (self.options.type == 'float') { if (self.options.type == 'float') {
value = '0.0'; self.options.value = '0.0';
} else if (self.options.type == 'int') { } else if (self.options.type == 'int') {
value = '0' self.options.value = '0'
} }
self.$input.val(value); self.$input.val(self.options.value);
cursor(0, value.length); cursor(0, self.options.value.length);
self.options.changeOnKeypress && that.triggerEvent({
change: {
value: self.options.value
}
});
} }
function clickArrow(i) { function clickArrow(i) {