PDA

View Full Version : TimeField validation



heliantis
16 Dec 2010, 8:58 AM
(i'm bad in english ;) )

Hello,

I would like validate 2 TimeField with my validator :



timerange : function (val, field) {
var date = field.parseDate(val);

if (!date || field.timerangevalidation) {
return false;
}

if (field.startTimeField ) {
var start = Ext.getCmp(field.startTimeField);
if(start){
date = new Date(date.getTime() - 15 * 60000);
start.setMaxValue(date);
start.timerangevalidation = true;
start.validate();
start.timerangevalidation = false;
}
} else if (field.endTimeField ) {
var end = Ext.getCmp(field.endTimeField);
if(end){
date = new Date(date.getTime() + 15 * 60000);
end.setMinValue(date);
end.timerangevalidation = true;
end.validate();
end.timerangevalidation = false;
}
}

return true;
}



It's ok ... But i have 2 DateField : dtStart and dtEnd..

I would like use my TimeField Validator ONLY if dtStart and dtEnd are equals.

Anyone can help me ?

Thank you