X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/BasicForm.html diff --git a/docs/source/BasicForm.html b/docs/source/BasicForm.html index 66605289..72f5ff3d 100644 --- a/docs/source/BasicForm.html +++ b/docs/source/BasicForm.html @@ -1,11 +1,17 @@ - - - The source code - - - - -
/** + + + The source code + + + + +
/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+
/** * @class Ext.form.BasicForm * @extends Ext.util.Observable *

Encapsulates the DOM <form> element at the heart of the {@link Ext.form.FormPanel FormPanel} class, and provides @@ -40,13 +46,13 @@ Ext.form.BasicForm = function(el, config){ if(Ext.isString(this.paramOrder)){ this.paramOrder = this.paramOrder.split(/[\s,|]/); } - /* +

/** * @property items * A {@link Ext.util.MixedCollection MixedCollection) containing all the Ext.form.Fields in this form. * @type MixedCollection */ this.items = new Ext.util.MixedCollection(false, function(o){ - return o.itemId || o.id || (o.id = Ext.id()); + return o.getItemId(); }); this.addEvents(
/** @@ -185,6 +191,11 @@ paramOrder: 'param1|param2|param' */ paramsAsHash: false, +
/** + * @cfg {String} waitTitle + * The default title to show for the waiting message box (defaults to 'Please Wait...') + */ + waitTitle: 'Please Wait...', // private activeAction : null, @@ -196,23 +207,21 @@ paramOrder: 'param1|param2|param' trackResetOnLoad : false,
/** - * @cfg {Boolean} standardSubmit If set to true, standard HTML form submits are used instead of XHR (Ajax) style - * form submissions. (defaults to false)
- *

Note: When using standardSubmit, the options to {@link #submit} are ignored because Ext's - * Ajax infrastracture is bypassed. To pass extra parameters (baseParams and params), you will need to - * create hidden fields within the form.

- *

The url config option is also bypassed, so set the action as well:

- *

-PANEL.getForm().getEl().dom.action = 'URL'
-     * 
- * An example encapsulating the above: + * @cfg {Boolean} standardSubmit + *

If set to true, standard HTML form submits are used instead + * of XHR (Ajax) style form submissions. Defaults to false.

+ *

Note: When using standardSubmit, the + * options to {@link #submit} are ignored because + * Ext's Ajax infrastracture is bypassed. To pass extra parameters (e.g. + * baseParams and params), utilize hidden fields + * to submit extra data, for example:

*

 new Ext.FormPanel({
     standardSubmit: true,
     baseParams: {
         foo: 'bar'
     },
-    url: 'myProcess.php',
+    {@link url}: 'myProcess.php',
     items: [{
         xtype: 'textfield',
         name: 'userName'
@@ -220,21 +229,25 @@ new Ext.FormPanel({
     buttons: [{
         text: 'Save',
         handler: function(){
-            var O = this.ownerCt;
-            if (O.getForm().isValid()) {
-                if (O.url)
-                    O.getForm().getEl().dom.action = O.url;
-                if (O.baseParams) {
-                    for (i in O.baseParams) {
-                        O.add({
+            var fp = this.ownerCt.ownerCt,
+                form = fp.getForm();
+            if (form.isValid()) {
+                // check if there are baseParams and if
+                // hiddent items have been added already
+                if (fp.baseParams && !fp.paramsAdded) {
+                    // add hidden items for all baseParams
+                    for (i in fp.baseParams) {
+                        fp.add({
                             xtype: 'hidden',
                             name: i,
-                            value: O.baseParams[i]
-                        })
+                            value: fp.baseParams[i]
+                        });
                     }
-                    O.doLayout();
+                    fp.doLayout();
+                    // set a custom flag to prevent re-adding
+                    fp.paramsAdded = true;
                 }
-                O.getForm().submit();
+                form.{@link #submit}();
             }
         }
     }]
@@ -431,7 +444,11 @@ myFormPanel.getForm().submit({
         if(this.standardSubmit){
             var v = this.isValid();
             if(v){
-                this.el.dom.submit();
+                var el = this.el.dom;
+                if(this.url && Ext.isEmpty(el.action)){
+                    el.action = this.url;
+                }
+                el.submit();
             }
             return v;
         }
@@ -491,7 +508,7 @@ myFormPanel.getForm().submit({
                 this.waitMsgTarget = Ext.get(this.waitMsgTarget);
                 this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
             }else{
-                Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');
+                Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle);
             }
         }
     },
@@ -733,6 +750,6 @@ myFormPanel.getForm().submit({
 });
 
 // back compat
-Ext.BasicForm = Ext.form.BasicForm;
- +Ext.BasicForm = Ext.form.BasicForm;
+ \ No newline at end of file