Roo/bootstrap/DateField.js
[roojs1] / Roo / bootstrap / DateField.js
index 6ac3480..9c25a53 100644 (file)
@@ -521,7 +521,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
         
         this.setValue(d);
                 
-//        this.hide();
+        this.hide();
     },
     
     show : function()
@@ -926,6 +926,73 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
     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;
+    },
+    
+    setVisible : function(visible)
+    {
+        if(!this.getEl()){
+            return;
+        }
+        
+        this.getEl().removeClass('hidden');
+        
+        if(visible){
+            return;
+        }
+        
+        this.getEl().addClass('hidden');
     }
    
 });