Roo/form/DateField.js
authorAlan Knowles <alan@roojs.com>
Mon, 30 Jul 2012 08:23:42 +0000 (16:23 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 30 Jul 2012 08:23:42 +0000 (16:23 +0800)
Roo/form/DateField.js

index aa12e01..5a7751a 100644 (file)
@@ -153,7 +153,7 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
             this.el.dom.removeAttribute('name'); 
             this.hiddenField = this.el.insertSibling({ tag:'input', type:'hidden', name: this.name },
                     'before', true);
-            this.hiddenField.value = this.formatDate(this.value, 'Y-m-d');
+            this.hiddenField.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
             // prevent input submission
             this.hiddenName = this.name;
         }
@@ -215,7 +215,9 @@ Roo.extend(Roo.form.DateField, Roo.form.TriggerField,  {
      */
     getValue : function(){
         
-        return  this.hiddenField ? this.hiddenField.value : this.parseDate(Roo.form.DateField.superclass.getValue.call(this)) || "";
+        return  this.hiddenField ?
+                this.hiddenField.value :
+                this.parseDate(Roo.form.DateField.superclass.getValue.call(this)) || "";
     },
 
     /**