Roo/form/Form.js
authorAlan Knowles <alan@akbkhome.com>
Mon, 26 Jul 2010 09:08:16 +0000 (17:08 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 26 Jul 2010 09:08:16 +0000 (17:08 +0800)
Roo/form/Form.js

index e5c95f5..ea2ac13 100644 (file)
@@ -204,6 +204,43 @@ Roo.extend(Roo.form.Form, Roo.form.BasicForm, {
         }
         return this;
     },
+    
+    /**
+     * Add a secondary form to this one, 
+     * Used to provide tabbed forms. One form is primary, with hidden values 
+     * which mirror the elements from the other forms.
+     * 
+     * 
+     */
+    
+    
+    addForm : function(form){
+       
+        form.allItems.each(function (fe) {
+            if (this.findField(fe.name)) { // already added..
+                return;
+            }
+            this.add( new Roo.form.Hidden({
+                name : fe.name,
+                
+               }
+            );
+            
+        }, this);
+        var r = [];
+        for(var i = 0, a = arguments, len = a.length; i < len; i++) {
+            if(a[i].isFormField){
+                r.push(a[i]);
+            }
+        }
+        if(r.length > 0){
+            Roo.form.Form.superclass.add.apply(this, r);
+        }
+        return this;
+    },
+    
+    
+    
      /**
      * Find any element that has been added to a form, using it's ID or name
      * This can include framesets, columns etc. along with regular fields..