onchange event is not triggering on datepicker(extended)

Hello All,

Could you please some help on this issue
my new datepicker:
dhx.protoUI({
name:“tmiDatePicker”,
defaults:{
startOnMonday: 0,
weekHeader: true,
},
$init:function(){
this.attachEvent(“onAfterRender”, function(){
TMIUtils.addCssForDatePicker(this.$view);
});
},
setValue:function(value){
var popup = dhx.ui.get(this.g.popup.toString());
if(typeof value==“string”&&value){
value = (this.g.externalDateFormat||this.g.dateFormat||dhx.i18n.dateFormatDate)(value);
}
if(popup!=undefined && popup != null){
var calendar = popup.l;
calendar.selectDate(value,true);
this.g.value = (value)?calendar.config.date:"";
}
this.g.text = this.getInput().innerHTML = (value)?((dhx.Date.dateToStr(’%D, %M %d, %Y’)||dhx.i18n.dateFormatStr)(this.g.value)):"";
}

			},dhx.ui.datepicker);

here am using this control my js
$$(“control_datepicker_2”).attachEvent(“onchange”, function(id, ev, trg){
var currentDate = new Date($$(‘control_datepicker_2’).getValue());
dhx.alert(“currentDate”+currentDate);
var year = currentDate.getFullYear();
var month = currentDate.getMonth()+1;
month = (month < 10) ? “0” + month : “” + month;
var day = currentDate.getDate();
day = (day < 10) ? “0” + day : “” + day;
var tempClearingDate = year+month+day;
TMI.page.completeCTSA.tempClearingDateTime = tempClearingDate +$$(‘hours’).getValue().replace(/:/g,"");

When i am trying to change the date ,event is not generating…

Please assist on this .

Many thanks…

You have redefined setValue method that called onChange event. Try to add the event call into method definition:

[code]setValue:function(value){
var oldvalue = this.config.value;

// then your code ...

this.callEvent("onChange", [value, oldvalue]);

}[/code]

Thank You Alex

Regards,
Basa.