Fire change when value is changed

This commit is contained in:
Nathan Gray 2012-03-20 17:45:51 +00:00
parent 04ced6e464
commit e28763b073

View File

@ -79,6 +79,7 @@ var et2_date = et2_inputWidget.extend({
}, },
set_value: function(_value) { set_value: function(_value) {
var old_value = this.value;
if(_value == null || _value == 0) if(_value == null || _value == 0)
{ {
this.value = _value; this.value = _value;
@ -87,6 +88,10 @@ var et2_date = et2_inputWidget.extend({
{ {
this.input_date.val(""); this.input_date.val("");
} }
if(old_value !== this.value)
{
this.onchange(this.input_date);
}
return; return;
} }
@ -95,6 +100,10 @@ var et2_date = et2_inputWidget.extend({
if(_value.indexOf(":") > 0 && this.type == "date-timeonly") { if(_value.indexOf(":") > 0 && this.type == "date-timeonly") {
this.value = _value; this.value = _value;
this.input_date.timepicker('setTime',_value); this.input_date.timepicker('setTime',_value);
if(old_value !== this.value)
{
this.onchange(this.input_date);
}
return; return;
} else { } else {
var text = new Date(_value); var text = new Date(_value);
@ -133,6 +142,10 @@ var et2_date = et2_inputWidget.extend({
timezone: this.date.getTimezoneOffset() timezone: this.date.getTimezoneOffset()
})); }));
} }
if(old_value != this.getValue())
{
this.change(this.input_date);
}
}, },
getValue: function() { getValue: function() {