X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..c8256059947f3aa8f5b0a9a2acf55e2142bb4742:/docs/source/BasicForm.html diff --git a/docs/source/BasicForm.html b/docs/source/BasicForm.html index 8501d05a..001f1b72 100644 --- a/docs/source/BasicForm.html +++ b/docs/source/BasicForm.html @@ -1,12 +1,18 @@ - - - - The source code - - - - -
/** + + + + The source code + + + + +
/*!
+ * Ext JS Library 3.2.1
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * 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 @@ -37,7 +43,7 @@ * @param {Object} config Configuration options */ Ext.form.BasicForm = Ext.extend(Ext.util.Observable, { - + constructor: function(el, config){ Ext.apply(this, config); if(Ext.isString(this.paramOrder)){ @@ -78,9 +84,9 @@ Ext.form.BasicForm = Ext.extend(Ext.util.Observable, { if(el){ this.initEl(el); } - Ext.form.BasicForm.superclass.constructor.call(this); + Ext.form.BasicForm.superclass.constructor.call(this); }, - +

/** * @cfg {String} method * The request method to use (GET or POST) for form actions if one isn't supplied in the action options. @@ -186,7 +192,7 @@ paramOrder: 'param1|param2|param' * {@link #paramOrder} nullifies this configuration. */ paramsAsHash: false, - +
/** * @cfg {String} waitTitle * The default title to show for the waiting message box (defaults to 'Please Wait...') @@ -280,15 +286,20 @@ new Ext.FormPanel({ e.stopEvent(); }, - // private - destroy: function() { - this.items.each(function(f){ - Ext.destroy(f); - }); - if(this.el){ - this.el.removeAllListeners(); - this.el.remove(); + /** + * Destroys this object. + * @private + * @param {Boolean} bound true if the object is bound to a form panel. If this is the case + * the FormPanel will take care of destroying certain things, so we're just doubling up. + */ + destroy: function(bound){ + if(bound !== true){ + this.items.each(function(f){ + Ext.destroy(f); + }); + Ext.destroy(this.el); } + this.items.clear(); this.purgeListeners(); }, @@ -437,8 +448,9 @@ myFormPanel.getForm().submit({ * @return {BasicForm} this */ submit : function(options){ + options = options || {}; if(this.standardSubmit){ - var v = this.isValid(); + var v = options.clientValidation === false || this.isValid(); if(v){ var el = this.el.dom; if(this.url && Ext.isEmpty(el.action)){ @@ -496,6 +508,12 @@ myFormPanel.getForm().submit({ // private beforeAction : function(action){ + // Call HtmlEditor's syncValue before actions + this.items.each(function(f){ + if(f.isFormField && f.syncValue){ + f.syncValue(); + } + }); var o = action.options; if(o.waitMsg){ if(this.waitMsgTarget === true){ @@ -541,15 +559,23 @@ myFormPanel.getForm().submit({ * {@link Ext.grid.Column#dataIndex dataIndex}, {@link Ext.form.Field#getName name or hiddenName}). * @return Field */ - findField : function(id){ + findField : function(id) { var field = this.items.get(id); - if(!Ext.isObject(field)){ - this.items.each(function(f){ - if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){ - field = f; - return false; + + if (!Ext.isObject(field)) { + //searches for the field corresponding to the given id. Used recursively for composite fields + var findMatchingField = function(f) { + if (f.isFormField) { + if (f.dataIndex == id || f.id == id || f.getName() == id) { + field = f; + return false; + } else if (f.isComposite && f.rendered) { + return f.items.each(findMatchingField); + } } - }); + }; + + this.items.each(findMatchingField); } return field || null; }, @@ -561,7 +587,7 @@ myFormPanel.getForm().submit({ * @return {BasicForm} this */ markInvalid : function(errors){ - if(Ext.isArray(errors)){ + if (Ext.isArray(errors)) { for(var i = 0, len = errors.length; i < len; i++){ var fieldError = errors[i]; var f = this.findField(fieldError.id); @@ -569,7 +595,7 @@ myFormPanel.getForm().submit({ f.markInvalid(fieldError.msg); } } - }else{ + } else { var field, id; for(id in errors){ if(!Ext.isFunction(errors[id]) && (field = this.findField(id))){ @@ -577,6 +603,7 @@ myFormPanel.getForm().submit({ } } } + return this; }, @@ -648,12 +675,12 @@ myFormPanel.getForm().submit({ n, key, val; - this.items.each(function(f){ - if(dirtyOnly !== true || f.isDirty()){ + this.items.each(function(f) { + if (dirtyOnly !== true || f.isDirty()) { n = f.getName(); key = o[n]; val = f.getValue(); - + if(Ext.isDefined(key)){ if(Ext.isArray(key)){ o[n].push(val); @@ -708,7 +735,6 @@ myFormPanel.getForm().submit({ return this; }, -
/** * Removes a field from the items collection (does NOT remove its markup). * @param {Field} field @@ -719,6 +745,13 @@ myFormPanel.getForm().submit({ return this; }, +
/** + * Removes all fields from the collection that have been destroyed. + */ + cleanDestroyed : function() { + this.items.filterBy(function(o) { return !!o.isDestroyed; }).each(this.remove, this); + }, +
/** * Iterates through the {@link Ext.form.Field Field}s which have been {@link #add add}ed to this BasicForm, * checks them for an id attribute, and calls {@link Ext.form.Field#applyToMarkup} on the existing dom element with that id. @@ -769,6 +802,7 @@ myFormPanel.getForm().submit({ }); // back compat -Ext.BasicForm = Ext.form.BasicForm;
- +Ext.BasicForm = Ext.form.BasicForm; +
+ \ No newline at end of file