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.2.1
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.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;
488 var field = this.findField(f.name);
490 record.set(f.name, field.getValue());
497 <div id="method-Ext.form.BasicForm-loadRecord"></div>/**
498 * Loads an {@link Ext.data.Record} into this form by calling {@link #setValues} with the
499 * {@link Ext.data.Record#data record data}.
500 * See also {@link #trackResetOnLoad}.
501 * @param {Record} record The record to load
502 * @return {BasicForm} this
504 loadRecord : function(record){
505 this.setValues(record.data);
510 beforeAction : function(action){
511 // Call HtmlEditor's syncValue before actions
512 this.items.each(function(f){
513 if(f.isFormField && f.syncValue){
517 var o = action.options;
519 if(this.waitMsgTarget === true){
520 this.el.mask(o.waitMsg, 'x-mask-loading');
521 }else if(this.waitMsgTarget){
522 this.waitMsgTarget = Ext.get(this.waitMsgTarget);
523 this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
525 Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle);
531 afterAction : function(action, success){
532 this.activeAction = null;
533 var o = action.options;
535 if(this.waitMsgTarget === true){
537 }else if(this.waitMsgTarget){
538 this.waitMsgTarget.unmask();
540 Ext.MessageBox.updateProgress(1);
541 Ext.MessageBox.hide();
548 Ext.callback(o.success, o.scope, [this, action]);
549 this.fireEvent('actioncomplete', this, action);
551 Ext.callback(o.failure, o.scope, [this, action]);
552 this.fireEvent('actionfailed', this, action);
556 <div id="method-Ext.form.BasicForm-findField"></div>/**
557 * Find a {@link Ext.form.Field} in this form.
558 * @param {String} id The value to search for (specify either a {@link Ext.Component#id id},
559 * {@link Ext.grid.Column#dataIndex dataIndex}, {@link Ext.form.Field#getName name or hiddenName}).
562 findField : function(id) {
563 var field = this.items.get(id);
565 if (!Ext.isObject(field)) {
566 //searches for the field corresponding to the given id. Used recursively for composite fields
567 var findMatchingField = function(f) {
569 if (f.dataIndex == id || f.id == id || f.getName() == id) {
572 } else if (f.isComposite && f.rendered) {
573 return f.items.each(findMatchingField);
578 this.items.each(findMatchingField);
580 return field || null;
584 <div id="method-Ext.form.BasicForm-markInvalid"></div>/**
585 * Mark fields in this form invalid in bulk.
586 * @param {Array/Object} errors Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
587 * @return {BasicForm} this
589 markInvalid : function(errors){
590 if (Ext.isArray(errors)) {
591 for(var i = 0, len = errors.length; i < len; i++){
592 var fieldError = errors[i];
593 var f = this.findField(fieldError.id);
595 f.markInvalid(fieldError.msg);
601 if(!Ext.isFunction(errors[id]) && (field = this.findField(id))){
602 field.markInvalid(errors[id]);
610 <div id="method-Ext.form.BasicForm-setValues"></div>/**
611 * Set values for fields in this form in bulk.
612 * @param {Array/Object} values Either an array in the form:<pre><code>
613 [{id:'clientName', value:'Fred. Olsen Lines'},
614 {id:'portOfLoading', value:'FXT'},
615 {id:'portOfDischarge', value:'OSL'} ]</code></pre>
616 * or an object hash of the form:<pre><code>
618 clientName: 'Fred. Olsen Lines',
619 portOfLoading: 'FXT',
620 portOfDischarge: 'OSL'
622 * @return {BasicForm} this
624 setValues : function(values){
625 if(Ext.isArray(values)){ // array of objects
626 for(var i = 0, len = values.length; i < len; i++){
628 var f = this.findField(v.id);
631 if(this.trackResetOnLoad){
632 f.originalValue = f.getValue();
636 }else{ // object hash
639 if(!Ext.isFunction(values[id]) && (field = this.findField(id))){
640 field.setValue(values[id]);
641 if(this.trackResetOnLoad){
642 field.originalValue = field.getValue();
650 <div id="method-Ext.form.BasicForm-getValues"></div>/**
651 * <p>Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
652 * If multiple fields exist with the same name they are returned as an array.</p>
653 * <p><b>Note:</b> The values are collected from all enabled HTML input elements within the form, <u>not</u> from
654 * the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the
655 * value can potentially be the emptyText of a field.</p>
656 * @param {Boolean} asString (optional) Pass true to return the values as a string. (defaults to false, returning an Object)
657 * @return {String/Object}
659 getValues : function(asString){
660 var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
661 if(asString === true){
664 return Ext.urlDecode(fs);
667 <div id="method-Ext.form.BasicForm-getFieldValues"></div>/**
668 * Retrieves the fields in the form as a set of key/value pairs, using the {@link Ext.form.Field#getValue getValue()} method.
669 * If multiple fields exist with the same name they are returned as an array.
670 * @param {Boolean} dirtyOnly (optional) True to return only fields that are dirty.
671 * @return {Object} The values in the form
673 getFieldValues : function(dirtyOnly){
678 this.items.each(function(f) {
679 if (dirtyOnly !== true || f.isDirty()) {
684 if(Ext.isDefined(key)){
685 if(Ext.isArray(key)){
698 <div id="method-Ext.form.BasicForm-clearInvalid"></div>/**
699 * Clears all invalid messages in this form.
700 * @return {BasicForm} this
702 clearInvalid : function(){
703 this.items.each(function(f){
709 <div id="method-Ext.form.BasicForm-reset"></div>/**
711 * @return {BasicForm} this
714 this.items.each(function(f){
720 <div id="method-Ext.form.BasicForm-add"></div>/**
721 * Add Ext.form Components to this form's Collection. This does not result in rendering of
722 * the passed Component, it just enables the form to validate Fields, and distribute values to
724 * <p><b>You will not usually call this function. In order to be rendered, a Field must be added
725 * to a {@link Ext.Container Container}, usually an {@link Ext.form.FormPanel FormPanel}.
726 * The FormPanel to which the field is added takes care of adding the Field to the BasicForm's
727 * collection.</b></p>
728 * @param {Field} field1
729 * @param {Field} field2 (optional)
730 * @param {Field} etc (optional)
731 * @return {BasicForm} this
734 this.items.addAll(Array.prototype.slice.call(arguments, 0));
738 <div id="method-Ext.form.BasicForm-remove"></div>/**
739 * Removes a field from the items collection (does NOT remove its markup).
740 * @param {Field} field
741 * @return {BasicForm} this
743 remove : function(field){
744 this.items.remove(field);
748 <div id="method-Ext.form.BasicForm-cleanDestroyed"></div>/**
749 * Removes all fields from the collection that have been destroyed.
751 cleanDestroyed : function() {
752 this.items.filterBy(function(o) { return !!o.isDestroyed; }).each(this.remove, this);
755 <div id="method-Ext.form.BasicForm-render"></div>/**
756 * Iterates through the {@link Ext.form.Field Field}s which have been {@link #add add}ed to this BasicForm,
757 * checks them for an id attribute, and calls {@link Ext.form.Field#applyToMarkup} on the existing dom element with that id.
758 * @return {BasicForm} this
761 this.items.each(function(f){
762 if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists
763 f.applyToMarkup(f.id);
769 <div id="method-Ext.form.BasicForm-applyToFields"></div>/**
770 * Calls {@link Ext#apply} for all fields in this form with the passed object.
771 * @param {Object} values
772 * @return {BasicForm} this
774 applyToFields : function(o){
775 this.items.each(function(f){
781 <div id="method-Ext.form.BasicForm-applyIfToFields"></div>/**
782 * Calls {@link Ext#applyIf} for all field in this form with the passed object.
783 * @param {Object} values
784 * @return {BasicForm} this
786 applyIfToFields : function(o){
787 this.items.each(function(f){
793 callFieldMethod : function(fnName, args){
795 this.items.each(function(f){
796 if(Ext.isFunction(f[fnName])){
797 f[fnName].apply(f, args);
805 Ext.BasicForm = Ext.form.BasicForm;