this.showMode();
if(this.isInline) {
- this.show();
+ this.showPopup();
}
},
this.picker().select('>.datepicker-days tbody',true).first().dom.innerHTML = '';
- while(prevMonth.valueOf() < nextMonth) {
+ while(prevMonth.valueOf() <= nextMonth) {
var clsName = '';
if (prevMonth.getUTCDay() === this.weekStart) {
onFocus : function()
{
Roo.bootstrap.DateField.superclass.onFocus.call(this);
- this.show();
+ this.showPopup();
},
onBlur : function()
this.setValue(d);
-// this.hide();
+ this.hidePopup();
},
- show : function()
+ showPopup : function()
{
this.picker().show();
this.update();
this.place();
- this.fireEvent('show', this, this.date);
+ this.fireEvent('showpopup', this, this.date);
},
- hide : function()
+ hidePopup : function()
{
if(this.isInline) {
return;
this.viewMode = this.startViewMode;
this.showMode();
- this.fireEvent('hide', this, this.date);
+ this.fireEvent('hidepopup', this, this.date);
},
{
if (!this.picker().isVisible()){
if (e.keyCode == 27) { // allow escape to hide and re-show picker
- this.show();
+ this.showPopup();
}
return;
}
switch(e.keyCode){
case 27: // escape
- this.hide();
+ this.hidePopup();
e.preventDefault();
break;
case 37: // left
break;
case 13: // enter
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
e.preventDefault();
break;
case 9: // tab
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
break;
case 16: // shift
case 17: // ctrl
case 18: // alt
break;
default :
- this.hide();
+ this.hidePopup();
}
},
// this.fill()
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
break;
}
break;
if(this.singleMode){
this.setValue(this.formatDate(this.viewDate));
- this.hide();
+ this.hidePopup();
return;
}
// this.fill();
//Roo.log(this.formatDate(this.date));
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
}
break;
}
remove: function()
{
this.picker().remove();
+ },
+
+ validateValue : function(value)
+ {
+ if(this.getVisibilityEl().hasClass('hidden')){
+ return true;
+ }
+
+ if(value.length < 1) {
+ if(this.allowBlank){
+ return true;
+ }
+ return false;
+ }
+
+ if(value.length < this.minLength){
+ return false;
+ }
+ if(value.length > this.maxLength){
+ return false;
+ }
+ if(this.vtype){
+ var vt = Roo.form.VTypes;
+ if(!vt[this.vtype](value, this)){
+ return false;
+ }
+ }
+ if(typeof this.validator == "function"){
+ var msg = this.validator(value);
+ if(msg !== true){
+ return false;
+ }
+ }
+
+ if(this.regex && !this.regex.test(value)){
+ return false;
+ }
+
+ if(typeof(this.parseDate(value)) == 'undefined'){
+ return false;
+ }
+
+ if (this.endDate !== Infinity && this.parseDate(value).getTime() > this.endDate.getTime()) {
+ return false;
+ }
+
+ if (this.startDate !== -Infinity && this.parseDate(value).getTime() < this.startDate.getTime()) {
+ return false;
+ }
+
+
+ return true;
+ },
+
+ reset : function()
+ {
+ this.date = this.viewDate = '';
+
+ Roo.bootstrap.DateField.superclass.setValue.call(this, '');
}
});