Roo/form/BasicForm.js
authorAlan Knowles <alan@akbkhome.com>
Tue, 12 Oct 2010 06:08:41 +0000 (14:08 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 12 Oct 2010 06:08:41 +0000 (14:08 +0800)
Roo/form/BasicForm.js

index 6ccb8f9..eec4c2f 100644 (file)
@@ -435,6 +435,29 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
         }
         return Roo.urlDecode(fs);
     },
+    /**
+     * Returns the fields in this form as an object with key/value pairs. 
+     * This differs from getValues as it calls getValue on each child item, rather than using dom data.
+     * @return {Object}
+     */
+    getFieldValues : function(){
+        if (this.childForms) {
+            // copy values from the child forms
+            Roo.each(this.childForms, function (f) {
+                this.setValues(f.getValues());
+            }, this);
+        }
+        
+        var ret = [];
+        this.items.each(function(f){
+            if (!f.getName()) {
+                continue;
+            }
+            ret[f.getName()] = f.getValue();
+        });
+        
+        return ret;
+    },
 
     /**
      * Clears all invalid messages in this form.