3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.form.BasicForm"></div>/**
16 * @class Ext.form.BasicForm
17 * @extends Ext.util.Observable
18 * <p>Encapsulates the DOM <form> element at the heart of the {@link Ext.form.FormPanel FormPanel} class, and provides
19 * input field management, validation, submission, and form loading services.</p>
20 * <p>By default, Ext Forms are submitted through Ajax, using an instance of {@link Ext.form.Action.Submit}.
21 * To enable normal browser submission of an Ext Form, use the {@link #standardSubmit} config option.</p>
22 * <p><b><u>File Uploads</u></b></p>
23 * <p>{@link #fileUpload File uploads} are not performed using Ajax submission, that
24 * is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
25 * manner with the DOM <tt><form></tt> element temporarily modified to have its
26 * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
27 * to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
28 * but removed after the return data has been gathered.</p>
29 * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
30 * server is using JSON to send the return object, then the
31 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
32 * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
33 * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
34 * "<" as "&lt;", "&" as "&amp;" etc.</p>
35 * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
36 * is created containing a <tt>responseText</tt> property in order to conform to the
37 * requirements of event handlers and callbacks.</p>
38 * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
39 * and some server technologies (notably JEE) may require some custom processing in order to
40 * retrieve parameter names and parameter values from the packet content.</p>
42 * @param {Mixed} el The form element or its id
43 * @param {Object} config Configuration options
45 Ext.form.BasicForm = Ext.extend(Ext.util.Observable, {
47 constructor: function(el, config){
48 Ext.apply(this, config);
49 if(Ext.isString(this.paramOrder)){
50 this.paramOrder = this.paramOrder.split(/[\s,|]/);
52 <div id="prop-Ext.form.BasicForm-items"></div>/**
53 * A {@link Ext.util.MixedCollection MixedCollection} containing all the Ext.form.Fields in this form.
54 * @type MixedCollection
57 this.items = new Ext.util.MixedCollection(false, function(o){
61 <div id="event-Ext.form.BasicForm-beforeaction"></div>/**
63 * Fires before any action is performed. Return false to cancel the action.
65 * @param {Action} action The {@link Ext.form.Action} to be performed
68 <div id="event-Ext.form.BasicForm-actionfailed"></div>/**
70 * Fires when an action fails.
72 * @param {Action} action The {@link Ext.form.Action} that failed
75 <div id="event-Ext.form.BasicForm-actioncomplete"></div>/**
76 * @event actioncomplete
77 * Fires when an action is completed.
79 * @param {Action} action The {@link Ext.form.Action} that completed
87 Ext.form.BasicForm.superclass.constructor.call(this);
90 <div id="cfg-Ext.form.BasicForm-method"></div>/**
91 * @cfg {String} method
92 * The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
94 <div id="cfg-Ext.form.BasicForm-reader"></div>/**
95 * @cfg {DataReader} reader
96 * An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to read
97 * data when executing 'load' actions. This is optional as there is built-in
98 * support for processing JSON. For additional information on using an XMLReader
99 * see the example provided in examples/form/xml-form.html.
101 <div id="cfg-Ext.form.BasicForm-errorReader"></div>/**
102 * @cfg {DataReader} errorReader
103 * <p>An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to
104 * read field error messages returned from 'submit' actions. This is optional
105 * as there is built-in support for processing JSON.</p>
106 * <p>The Records which provide messages for the invalid Fields must use the
107 * Field name (or id) as the Record ID, and must contain a field called 'msg'
108 * which contains the error message.</p>
109 * <p>The errorReader does not have to be a full-blown implementation of a
110 * DataReader. It simply needs to implement a <tt>read(xhr)</tt> function
111 * which returns an Array of Records in an object with the following
112 * structure:</p><pre><code>
118 <div id="cfg-Ext.form.BasicForm-url"></div>/**
120 * The URL to use for form actions if one isn't supplied in the
121 * <code>{@link #doAction doAction} options</code>.
123 <div id="cfg-Ext.form.BasicForm-fileUpload"></div>/**
124 * @cfg {Boolean} fileUpload
125 * Set to true if this form is a file upload.
126 * <p>File uploads are not performed using normal 'Ajax' techniques, that is they are <b>not</b>
127 * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
128 * DOM <tt><form></tt> element temporarily modified to have its
129 * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
130 * to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
131 * but removed after the return data has been gathered.</p>
132 * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
133 * server is using JSON to send the return object, then the
134 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
135 * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
136 * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
137 * "<" as "&lt;", "&" as "&amp;" etc.</p>
138 * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
139 * is created containing a <tt>responseText</tt> property in order to conform to the
140 * requirements of event handlers and callbacks.</p>
141 * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
142 * and some server technologies (notably JEE) may require some custom processing in order to
143 * retrieve parameter names and parameter values from the packet content.</p>
145 <div id="cfg-Ext.form.BasicForm-baseParams"></div>/**
146 * @cfg {Object} baseParams
147 * <p>Parameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.</p>
148 * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p>
150 <div id="cfg-Ext.form.BasicForm-timeout"></div>/**
151 * @cfg {Number} timeout Timeout for form actions in seconds (default is 30 seconds).
155 <div id="cfg-Ext.form.BasicForm-api"></div>/**
156 * @cfg {Object} api (Optional) If specified load and submit actions will be handled
157 * with {@link Ext.form.Action.DirectLoad} and {@link Ext.form.Action.DirectSubmit}.
158 * Methods which have been imported by Ext.Direct can be specified here to load and submit
160 * Such as the following:<pre><code>
162 load: App.ss.MyProfile.load,
163 submit: App.ss.MyProfile.submit
166 * <p>Load actions can use <code>{@link #paramOrder}</code> or <code>{@link #paramsAsHash}</code>
167 * to customize how the load method is invoked.
168 * Submit actions will always use a standard form submit. The formHandler configuration must
169 * be set on the associated server-side method which has been imported by Ext.Direct</p>
172 <div id="cfg-Ext.form.BasicForm-paramOrder"></div>/**
173 * @cfg {Array/String} paramOrder <p>A list of params to be executed server side.
174 * Defaults to <tt>undefined</tt>. Only used for the <code>{@link #api}</code>
175 * <code>load</code> configuration.</p>
176 * <br><p>Specify the params in the order in which they must be executed on the
177 * server-side as either (1) an Array of String values, or (2) a String of params
178 * delimited by either whitespace, comma, or pipe. For example,
179 * any of the following would be acceptable:</p><pre><code>
180 paramOrder: ['param1','param2','param3']
181 paramOrder: 'param1 param2 param3'
182 paramOrder: 'param1,param2,param3'
183 paramOrder: 'param1|param2|param'
186 paramOrder: undefined,
188 <div id="cfg-Ext.form.BasicForm-paramsAsHash"></div>/**
189 * @cfg {Boolean} paramsAsHash Only used for the <code>{@link #api}</code>
190 * <code>load</code> configuration. Send parameters as a collection of named
191 * arguments (defaults to <tt>false</tt>). Providing a
192 * <tt>{@link #paramOrder}</tt> nullifies this configuration.
196 <div id="cfg-Ext.form.BasicForm-waitTitle"></div>/**
197 * @cfg {String} waitTitle
198 * The default title to show for the waiting message box (defaults to <tt>'Please Wait...'</tt>)
200 waitTitle: 'Please Wait...',
205 <div id="cfg-Ext.form.BasicForm-trackResetOnLoad"></div>/**
206 * @cfg {Boolean} trackResetOnLoad If set to <tt>true</tt>, {@link #reset}() resets to the last loaded
207 * or {@link #setValues}() data instead of when the form was first created. Defaults to <tt>false</tt>.
209 trackResetOnLoad : false,
211 <div id="cfg-Ext.form.BasicForm-standardSubmit"></div>/**
212 * @cfg {Boolean} standardSubmit
213 * <p>If set to <tt>true</tt>, standard HTML form submits are used instead
214 * of XHR (Ajax) style form submissions. Defaults to <tt>false</tt>.</p>
215 * <br><p><b>Note:</b> When using <code>standardSubmit</code>, the
216 * <code>options</code> to <code>{@link #submit}</code> are ignored because
217 * Ext's Ajax infrastracture is bypassed. To pass extra parameters (e.g.
218 * <code>baseParams</code> and <code>params</code>), utilize hidden fields
219 * to submit extra data, for example:</p>
222 standardSubmit: true,
226 {@link url}: 'myProcess.php',
234 var fp = this.ownerCt.ownerCt,
236 if (form.isValid()) {
237 // check if there are baseParams and if
238 // hiddent items have been added already
239 if (fp.baseParams && !fp.paramsAdded) {
240 // add hidden items for all baseParams
241 for (i in fp.baseParams) {
245 value: fp.baseParams[i]
249 // set a custom flag to prevent re-adding
250 fp.paramsAdded = true;
252 form.{@link #submit}();
259 <div id="prop-Ext.form.BasicForm-waitMsgTarget"></div>/**
260 * By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
261 * element by passing it or its id or mask the form itself by passing in true.
263 * @property waitMsgTarget
267 initEl : function(el){
268 this.el = Ext.get(el);
269 this.id = this.el.id || Ext.id();
270 if(!this.standardSubmit){
271 this.el.on('submit', this.onSubmit, this);
273 this.el.addClass('x-form');
276 <div id="method-Ext.form.BasicForm-getEl"></div>/**
277 * Get the HTML form Element
278 * @return Ext.Element
285 onSubmit : function(e){
290 * Destroys this object.
292 * @param {Boolean} bound true if the object is bound to a form panel. If this is the case
293 * the FormPanel will take care of destroying certain things, so we're just doubling up.
295 destroy: function(bound){
297 this.items.each(function(f){
300 Ext.destroy(this.el);
303 this.purgeListeners();
306 <div id="method-Ext.form.BasicForm-isValid"></div>/**
307 * Returns true if client-side validation on the form is successful.
310 isValid : function(){
312 this.items.each(function(f){
320 <div id="method-Ext.form.BasicForm-isDirty"></div>/**
321 * <p>Returns true if any fields in this form have changed from their original values.</p>
322 * <p>Note that if this BasicForm was configured with {@link #trackResetOnLoad} then the
323 * Fields' <i>original values</i> are updated when the values are loaded by {@link #setValues}
324 * or {@link #loadRecord}.</p>
327 isDirty : function(){
329 this.items.each(function(f){
338 <div id="method-Ext.form.BasicForm-doAction"></div>/**
339 * Performs a predefined action ({@link Ext.form.Action.Submit} or
340 * {@link Ext.form.Action.Load}) or a custom extension of {@link Ext.form.Action}
341 * to perform application-specific processing.
342 * @param {String/Object} actionName The name of the predefined action type,
343 * or instance of {@link Ext.form.Action} to perform.
344 * @param {Object} options (optional) The options to pass to the {@link Ext.form.Action}.
345 * All of the config options listed below are supported by both the
346 * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
347 * actions unless otherwise noted (custom actions could also accept
348 * other config options):<ul>
350 * <li><b>url</b> : String<div class="sub-desc">The url for the action (defaults
351 * to the form's {@link #url}.)</div></li>
353 * <li><b>method</b> : String<div class="sub-desc">The form method to use (defaults
354 * to the form's method, or POST if not defined)</div></li>
356 * <li><b>params</b> : String/Object<div class="sub-desc"><p>The params to pass
357 * (defaults to the form's baseParams, or none if not defined)</p>
358 * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p></div></li>
360 * <li><b>headers</b> : Object<div class="sub-desc">Request headers to set for the action
361 * (defaults to the form's default headers)</div></li>
363 * <li><b>success</b> : Function<div class="sub-desc">The callback that will
364 * be invoked after a successful response (see top of
365 * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
366 * for a description of what constitutes a successful response).
367 * The function is passed the following parameters:<ul>
368 * <li><tt>form</tt> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
369 * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
370 * <div class="sub-desc">The action object contains these properties of interest:<ul>
371 * <li><tt>{@link Ext.form.Action#response response}</tt></li>
372 * <li><tt>{@link Ext.form.Action#result result}</tt> : interrogate for custom postprocessing</li>
373 * <li><tt>{@link Ext.form.Action#type type}</tt></li>
374 * </ul></div></li></ul></div></li>
376 * <li><b>failure</b> : Function<div class="sub-desc">The callback that will be invoked after a
377 * failed transaction attempt. The function is passed the following parameters:<ul>
378 * <li><tt>form</tt> : The {@link Ext.form.BasicForm} that requested the action.</li>
379 * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
380 * <div class="sub-desc">The action object contains these properties of interest:<ul>
381 * <li><tt>{@link Ext.form.Action#failureType failureType}</tt></li>
382 * <li><tt>{@link Ext.form.Action#response response}</tt></li>
383 * <li><tt>{@link Ext.form.Action#result result}</tt> : interrogate for custom postprocessing</li>
384 * <li><tt>{@link Ext.form.Action#type type}</tt></li>
385 * </ul></div></li></ul></div></li>
387 * <li><b>scope</b> : Object<div class="sub-desc">The scope in which to call the
388 * callback functions (The <tt>this</tt> reference for the callback functions).</div></li>
390 * <li><b>clientValidation</b> : Boolean<div class="sub-desc">Submit Action only.
391 * Determines whether a Form's fields are validated in a final call to
392 * {@link Ext.form.BasicForm#isValid isValid} prior to submission. Set to <tt>false</tt>
393 * to prevent this. If undefined, pre-submission field validation is performed.</div></li></ul>
395 * @return {BasicForm} this
397 doAction : function(action, options){
398 if(Ext.isString(action)){
399 action = new Ext.form.Action.ACTION_TYPES[action](this, options);
401 if(this.fireEvent('beforeaction', this, action) !== false){
402 this.beforeAction(action);
403 action.run.defer(100, action);
408 <div id="method-Ext.form.BasicForm-submit"></div>/**
409 * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Submit submit action}.
410 * @param {Object} options The options to pass to the action (see {@link #doAction} for details).<br>
411 * <p><b>Note:</b> this is ignored when using the {@link #standardSubmit} option.</p>
412 * <p>The following code:</p><pre><code>
413 myFormPanel.getForm().submit({
414 clientValidation: true,
415 url: 'updateConsignment.php',
417 newStatus: 'delivered'
419 success: function(form, action) {
420 Ext.Msg.alert('Success', action.result.msg);
422 failure: function(form, action) {
423 switch (action.failureType) {
424 case Ext.form.Action.CLIENT_INVALID:
425 Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
427 case Ext.form.Action.CONNECT_FAILURE:
428 Ext.Msg.alert('Failure', 'Ajax communication failed');
430 case Ext.form.Action.SERVER_INVALID:
431 Ext.Msg.alert('Failure', action.result.msg);
436 * would process the following server response for a successful submission:<pre><code>
438 "success":true, // note this is Boolean, not string
439 "msg":"Consignment updated"
442 * and the following server response for a failed submission:<pre><code>
444 "success":false, // note this is Boolean, not string
445 "msg":"You do not have permission to perform this operation"
448 * @return {BasicForm} this
450 submit : function(options){
451 options = options || {};
452 if(this.standardSubmit){
453 var v = options.clientValidation === false || this.isValid();
455 var el = this.el.dom;
456 if(this.url && Ext.isEmpty(el.action)){
457 el.action = this.url;
463 var submitAction = String.format('{0}submit', this.api ? 'direct' : '');
464 this.doAction(submitAction, options);
468 <div id="method-Ext.form.BasicForm-load"></div>/**
469 * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Load load action}.
470 * @param {Object} options The options to pass to the action (see {@link #doAction} for details)
471 * @return {BasicForm} this
473 load : function(options){
474 var loadAction = String.format('{0}load', this.api ? 'direct' : '');
475 this.doAction(loadAction, options);
479 <div id="method-Ext.form.BasicForm-updateRecord"></div>/**
480 * Persists the values in this form into the passed {@link Ext.data.Record} object in a beginEdit/endEdit block.
481 * @param {Record} record The record to edit
482 * @return {BasicForm} this
484 updateRecord : function(record){
486 var fs = record.fields,
490 field = this.findField(f.name);
492 value = field.getValue();
493 if (typeof value != undefined && value.getGroupValue) {
494 value = value.getGroupValue();
495 } else if ( field.eachItem ) {
497 field.eachItem(function(item){
498 value.push(item.getValue());
501 record.set(f.name, value);
508 <div id="method-Ext.form.BasicForm-loadRecord"></div>/**
509 * Loads an {@link Ext.data.Record} into this form by calling {@link #setValues} with the
510 * {@link Ext.data.Record#data record data}.
511 * See also {@link #trackResetOnLoad}.
512 * @param {Record} record The record to load
513 * @return {BasicForm} this
515 loadRecord : function(record){
516 this.setValues(record.data);
521 beforeAction : function(action){
522 // Call HtmlEditor's syncValue before actions
523 this.items.each(function(f){
524 if(f.isFormField && f.syncValue){
528 var o = action.options;
530 if(this.waitMsgTarget === true){
531 this.el.mask(o.waitMsg, 'x-mask-loading');
532 }else if(this.waitMsgTarget){
533 this.waitMsgTarget = Ext.get(this.waitMsgTarget);
534 this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
536 Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle);
542 afterAction : function(action, success){
543 this.activeAction = null;
544 var o = action.options;
546 if(this.waitMsgTarget === true){
548 }else if(this.waitMsgTarget){
549 this.waitMsgTarget.unmask();
551 Ext.MessageBox.updateProgress(1);
552 Ext.MessageBox.hide();
559 Ext.callback(o.success, o.scope, [this, action]);
560 this.fireEvent('actioncomplete', this, action);
562 Ext.callback(o.failure, o.scope, [this, action]);
563 this.fireEvent('actionfailed', this, action);
567 <div id="method-Ext.form.BasicForm-findField"></div>/**
568 * Find a {@link Ext.form.Field} in this form.
569 * @param {String} id The value to search for (specify either a {@link Ext.Component#id id},
570 * {@link Ext.grid.Column#dataIndex dataIndex}, {@link Ext.form.Field#getName name or hiddenName}).
573 findField : function(id) {
574 var field = this.items.get(id);
576 if (!Ext.isObject(field)) {
577 //searches for the field corresponding to the given id. Used recursively for composite fields
578 var findMatchingField = function(f) {
580 if (f.dataIndex == id || f.id == id || f.getName() == id) {
583 } else if (f.isComposite) {
584 return f.items.each(findMatchingField);
585 } else if (f instanceof Ext.form.CheckboxGroup && f.rendered) {
586 return f.eachItem(findMatchingField);
591 this.items.each(findMatchingField);
593 return field || null;
597 <div id="method-Ext.form.BasicForm-markInvalid"></div>/**
598 * Mark fields in this form invalid in bulk.
599 * @param {Array/Object} errors Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
600 * @return {BasicForm} this
602 markInvalid : function(errors){
603 if (Ext.isArray(errors)) {
604 for(var i = 0, len = errors.length; i < len; i++){
605 var fieldError = errors[i];
606 var f = this.findField(fieldError.id);
608 f.markInvalid(fieldError.msg);
614 if(!Ext.isFunction(errors[id]) && (field = this.findField(id))){
615 field.markInvalid(errors[id]);
623 <div id="method-Ext.form.BasicForm-setValues"></div>/**
624 * Set values for fields in this form in bulk.
625 * @param {Array/Object} values Either an array in the form:<pre><code>
626 [{id:'clientName', value:'Fred. Olsen Lines'},
627 {id:'portOfLoading', value:'FXT'},
628 {id:'portOfDischarge', value:'OSL'} ]</code></pre>
629 * or an object hash of the form:<pre><code>
631 clientName: 'Fred. Olsen Lines',
632 portOfLoading: 'FXT',
633 portOfDischarge: 'OSL'
635 * @return {BasicForm} this
637 setValues : function(values){
638 if(Ext.isArray(values)){ // array of objects
639 for(var i = 0, len = values.length; i < len; i++){
641 var f = this.findField(v.id);
644 if(this.trackResetOnLoad){
645 f.originalValue = f.getValue();
649 }else{ // object hash
652 if(!Ext.isFunction(values[id]) && (field = this.findField(id))){
653 field.setValue(values[id]);
654 if(this.trackResetOnLoad){
655 field.originalValue = field.getValue();
663 <div id="method-Ext.form.BasicForm-getValues"></div>/**
664 * <p>Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
665 * If multiple fields exist with the same name they are returned as an array.</p>
666 * <p><b>Note:</b> The values are collected from all enabled HTML input elements within the form, <u>not</u> from
667 * the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the
668 * value can potentially be the emptyText of a field.</p>
669 * @param {Boolean} asString (optional) Pass true to return the values as a string. (defaults to false, returning an Object)
670 * @return {String/Object}
672 getValues : function(asString){
673 var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
674 if(asString === true){
677 return Ext.urlDecode(fs);
680 <div id="method-Ext.form.BasicForm-getFieldValues"></div>/**
681 * Retrieves the fields in the form as a set of key/value pairs, using the {@link Ext.form.Field#getValue getValue()} method.
682 * If multiple fields exist with the same name they are returned as an array.
683 * @param {Boolean} dirtyOnly (optional) True to return only fields that are dirty.
684 * @return {Object} The values in the form
686 getFieldValues : function(dirtyOnly){
691 this.items.each(function(f) {
692 if (!f.disabled && (dirtyOnly !== true || f.isDirty())) {
697 if(Ext.isDefined(key)){
698 if(Ext.isArray(key)){
711 <div id="method-Ext.form.BasicForm-clearInvalid"></div>/**
712 * Clears all invalid messages in this form.
713 * @return {BasicForm} this
715 clearInvalid : function(){
716 this.items.each(function(f){
722 <div id="method-Ext.form.BasicForm-reset"></div>/**
724 * @return {BasicForm} this
727 this.items.each(function(f){
733 <div id="method-Ext.form.BasicForm-add"></div>/**
734 * Add Ext.form Components to this form's Collection. This does not result in rendering of
735 * the passed Component, it just enables the form to validate Fields, and distribute values to
737 * <p><b>You will not usually call this function. In order to be rendered, a Field must be added
738 * to a {@link Ext.Container Container}, usually an {@link Ext.form.FormPanel FormPanel}.
739 * The FormPanel to which the field is added takes care of adding the Field to the BasicForm's
740 * collection.</b></p>
741 * @param {Field} field1
742 * @param {Field} field2 (optional)
743 * @param {Field} etc (optional)
744 * @return {BasicForm} this
747 this.items.addAll(Array.prototype.slice.call(arguments, 0));
751 <div id="method-Ext.form.BasicForm-remove"></div>/**
752 * Removes a field from the items collection (does NOT remove its markup).
753 * @param {Field} field
754 * @return {BasicForm} this
756 remove : function(field){
757 this.items.remove(field);
761 <div id="method-Ext.form.BasicForm-cleanDestroyed"></div>/**
762 * Removes all fields from the collection that have been destroyed.
764 cleanDestroyed : function() {
765 this.items.filterBy(function(o) { return !!o.isDestroyed; }).each(this.remove, this);
768 <div id="method-Ext.form.BasicForm-render"></div>/**
769 * Iterates through the {@link Ext.form.Field Field}s which have been {@link #add add}ed to this BasicForm,
770 * checks them for an id attribute, and calls {@link Ext.form.Field#applyToMarkup} on the existing dom element with that id.
771 * @return {BasicForm} this
774 this.items.each(function(f){
775 if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists
776 f.applyToMarkup(f.id);
782 <div id="method-Ext.form.BasicForm-applyToFields"></div>/**
783 * Calls {@link Ext#apply} for all fields in this form with the passed object.
784 * @param {Object} values
785 * @return {BasicForm} this
787 applyToFields : function(o){
788 this.items.each(function(f){
794 <div id="method-Ext.form.BasicForm-applyIfToFields"></div>/**
795 * Calls {@link Ext#applyIf} for all field in this form with the passed object.
796 * @param {Object} values
797 * @return {BasicForm} this
799 applyIfToFields : function(o){
800 this.items.each(function(f){
806 callFieldMethod : function(fnName, args){
808 this.items.each(function(f){
809 if(Ext.isFunction(f[fnName])){
810 f[fnName].apply(f, args);
818 Ext.BasicForm = Ext.form.BasicForm;