Roo/form/ComboBoxArray.js
[roojs1] / Roo / form / DateField.js
index 8785851..61e4935 100644 (file)
@@ -150,7 +150,9 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
     {
         Roo.form.DateField.superclass.onRender.call(this, ct, position);
         if (this.useIso) {
-            this.el.dom.removeAttribute('name'); 
+            //this.el.dom.removeAttribute('name'); 
+            Roo.log("Changing name?");
+            this.el.dom.setAttribute('name', this.name + '____hidden___' ); 
             this.hiddenField = this.el.insertSibling({ tag:'input', type:'hidden', name: this.name },
                     'before', true);
             this.hiddenField.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
@@ -166,6 +168,7 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
     {
         value = this.formatDate(value);
         if(!Roo.form.DateField.superclass.validateValue.call(this, value)){
+            Roo.log('super failed');
             return false;
         }
         if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
@@ -174,6 +177,7 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
         var svalue = value;
         value = this.parseDate(value);
         if(!value){
+            Roo.log('parse date failed' + svalue);
             this.markInvalid(String.format(this.invalidText, svalue, this.format));
             return false;
         }
@@ -208,6 +212,14 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
     validateBlur : function(){
         return !this.menu || !this.menu.isVisible();
     },
+    
+    getName: function()
+    {
+        // returns hidden if it's set..
+        if (!this.rendered) {return ''};
+        return !this.hiddenName && this.el.dom.name  ? this.el.dom.name : (this.hiddenName || '');
+        
+    },
 
     /**
      * Returns the current date value of the date field.
@@ -258,7 +270,7 @@ dateField.setValue('2006-5-4');
             return value;
         }
         var v = Date.parseDate(value, this.format);
-         if (this.useIso) {
+         if (!v && this.useIso) {
             v = Date.parseDate(value, 'Y-m-d');
         }
         if(!v && this.altFormats){
@@ -330,13 +342,22 @@ dateField.setValue('2006-5-4');
         if(v){
             this.setValue(v);
         }
-    }
+    },
 
-    /** @cfg {Boolean} grow @hide */
-    /** @cfg {Number} growMin @hide */
-    /** @cfg {Number} growMax @hide */
-    /**
-     * @hide
-     * @method autoSize
+    /*@
+     * overide
+     * 
      */
+    isDirty : function() {
+        if(this.disabled) {
+            return false;
+        }
+        
+        if(typeof(this.startValue) === 'undefined'){
+            return false;
+        }
+        
+        return String(this.getValue()) !== String(this.startValue);
+        
+    }
 });
\ No newline at end of file