Roo/bootstrap/DateField.js
authoredward <edward@roojs.com>
Tue, 8 Aug 2017 10:51:17 +0000 (18:51 +0800)
committeredward <edward@roojs.com>
Tue, 8 Aug 2017 10:51:17 +0000 (18:51 +0800)
Roo/bootstrap/DateField.js

index 9429015..ea0c41c 100644 (file)
@@ -928,15 +928,39 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
         this.picker().remove();
     },
     
-    validate : function()
+    validateValue : function(value)
     {
-        if(this.disabled || this.validateValue(this.getRawValue())){
-            this.markValid();
-            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;
         }
         
-        this.markInvalid();
-        return false;
+        return true;
     },
    
 });