3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.form.BasicForm"></div>/**
10 * @class Ext.form.BasicForm
11 * @extends Ext.util.Observable
12 * <p>Encapsulates the DOM <form> element at the heart of the {@link Ext.form.FormPanel FormPanel} class, and provides
13 * input field management, validation, submission, and form loading services.</p>
14 * <p>By default, Ext Forms are submitted through Ajax, using an instance of {@link Ext.form.Action.Submit}.
15 * To enable normal browser submission of an Ext Form, use the {@link #standardSubmit} config option.</p>
16 * <p><b><u>File Uploads</u></b></p>
17 * <p>{@link #fileUpload File uploads} are not performed using Ajax submission, that
18 * is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
19 * manner with the DOM <tt><form></tt> element temporarily modified to have its
20 * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
21 * to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
22 * but removed after the return data has been gathered.</p>
23 * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
24 * server is using JSON to send the return object, then the
25 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
26 * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
27 * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
28 * "<" as "&lt;", "&" as "&amp;" etc.</p>
29 * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
30 * is created containing a <tt>responseText</tt> property in order to conform to the
31 * requirements of event handlers and callbacks.</p>
32 * <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>
33 * and some server technologies (notably JEE) may require some custom processing in order to
34 * retrieve parameter names and parameter values from the packet content.</p>
36 * @param {Mixed} el The form element or its id
37 * @param {Object} config Configuration options
39 Ext.form.BasicForm = Ext.extend(Ext.util.Observable, {
41 constructor: function(el, config){
42 Ext.apply(this, config);
43 if(Ext.isString(this.paramOrder)){
44 this.paramOrder = this.paramOrder.split(/[\s,|]/);
46 <div id="prop-Ext.form.BasicForm-items"></div>/**
47 * A {@link Ext.util.MixedCollection MixedCollection} containing all the Ext.form.Fields in this form.
48 * @type MixedCollection
51 this.items = new Ext.util.MixedCollection(false, function(o){
55 <div id="event-Ext.form.BasicForm-beforeaction"></div>/**
57 * Fires before any action is performed. Return false to cancel the action.
59 * @param {Action} action The {@link Ext.form.Action} to be performed
62 <div id="event-Ext.form.BasicForm-actionfailed"></div>/**
64 * Fires when an action fails.
66 * @param {Action} action The {@link Ext.form.Action} that failed
69 <div id="event-Ext.form.BasicForm-actioncomplete"></div>/**
70 * @event actioncomplete
71 * Fires when an action is completed.
73 * @param {Action} action The {@link Ext.form.Action} that completed
81 Ext.form.BasicForm.superclass.constructor.call(this);
84 <div id="cfg-Ext.form.BasicForm-method"></div>/**
85 * @cfg {String} method
86 * The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
88 <div id="cfg-Ext.form.BasicForm-reader"></div>/**
89 * @cfg {DataReader} reader
90 * An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to read
91 * data when executing 'load' actions. This is optional as there is built-in
92 * support for processing JSON. For additional information on using an XMLReader
93 * see the example provided in examples/form/xml-form.html.
95 <div id="cfg-Ext.form.BasicForm-errorReader"></div>/**
96 * @cfg {DataReader} errorReader
97 * <p>An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to
98 * read field error messages returned from 'submit' actions. This is optional
99 * as there is built-in support for processing JSON.</p>
100 * <p>The Records which provide messages for the invalid Fields must use the
101 * Field name (or id) as the Record ID, and must contain a field called 'msg'
102 * which contains the error message.</p>
103 * <p>The errorReader does not have to be a full-blown implementation of a
104 * DataReader. It simply needs to implement a <tt>read(xhr)</tt> function
105 * which returns an Array of Records in an object with the following
106 * structure:</p><pre><code>
112 <div id="cfg-Ext.form.BasicForm-url"></div>/**
114 * The URL to use for form actions if one isn't supplied in the
115 * <code>{@link #doAction doAction} options</code>.
117 <div id="cfg-Ext.form.BasicForm-fileUpload"></div>/**
118 * @cfg {Boolean} fileUpload
119 * Set to true if this form is a file upload.
120 * <p>File uploads are not performed using normal 'Ajax' techniques, that is they are <b>not</b>
121 * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
122 * DOM <tt><form></tt> element temporarily modified to have its
123 * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
124 * to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
125 * but removed after the return data has been gathered.</p>
126 * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
127 * server is using JSON to send the return object, then the
128 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
129 * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
130 * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
131 * "<" as "&lt;", "&" as "&amp;" etc.</p>
132 * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
133 * is created containing a <tt>responseText</tt> property in order to conform to the
134 * requirements of event handlers and callbacks.</p>
135 * <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>
136 * and some server technologies (notably JEE) may require some custom processing in order to
137 * retrieve parameter names and parameter values from the packet content.</p>
139 <div id="cfg-Ext.form.BasicForm-baseParams"></div>/**
140 * @cfg {Object} baseParams
141 * <p>Parameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.</p>
142 * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p>
144 <div id="cfg-Ext.form.BasicForm-timeout"></div>/**
145 * @cfg {Number} timeout Timeout for form actions in seconds (default is 30 seconds).
149 <div id="cfg-Ext.form.BasicForm-api"></div>/**
150 * @cfg {Object} api (Optional) If specified load and submit actions will be handled
151 * with {@link Ext.form.Action.DirectLoad} and {@link Ext.form.Action.DirectSubmit}.
152 * Methods which have been imported by Ext.Direct can be specified here to load and submit
154 * Such as the following:<pre><code>
156 load: App.ss.MyProfile.load,
157 submit: App.ss.MyProfile.submit
160 * <p>Load actions can use <code>{@link #paramOrder}</code> or <code>{@link #paramsAsHash}</code>
161 * to customize how the load method is invoked.
162 * Submit actions will always use a standard form submit. The formHandler configuration must
163 * be set on the associated server-side method which has been imported by Ext.Direct</p>
166 <div id="cfg-Ext.form.BasicForm-paramOrder"></div>/**
167 * @cfg {Array/String} paramOrder <p>A list of params to be executed server side.
168 * Defaults to <tt>undefined</tt>. Only used for the <code>{@link #api}</code>
169 * <code>load</code> configuration.</p>
170 * <br><p>Specify the params in the order in which they must be executed on the
171 * server-side as either (1) an Array of String values, or (2) a String of params
172 * delimited by either whitespace, comma, or pipe. For example,
173 * any of the following would be acceptable:</p><pre><code>
174 paramOrder: ['param1','param2','param3']
175 paramOrder: 'param1 param2 param3'
176 paramOrder: 'param1,param2,param3'
177 paramOrder: 'param1|param2|param'
180 paramOrder: undefined,
182 <div id="cfg-Ext.form.BasicForm-paramsAsHash"></div>/**
183 * @cfg {Boolean} paramsAsHash Only used for the <code>{@link #api}</code>
184 * <code>load</code> configuration. Send parameters as a collection of named
185 * arguments (defaults to <tt>false</tt>). Providing a
186 * <tt>{@link #paramOrder}</tt> nullifies this configuration.
190 <div id="cfg-Ext.form.BasicForm-waitTitle"></div>/**
191 * @cfg {String} waitTitle
192 * The default title to show for the waiting message box (defaults to <tt>'Please Wait...'</tt>)
194 waitTitle: 'Please Wait...',
199 <div id="cfg-Ext.form.BasicForm-trackResetOnLoad"></div>/**
200 * @cfg {Boolean} trackResetOnLoad If set to <tt>true</tt>, {@link #reset}() resets to the last loaded
201 * or {@link #setValues}() data instead of when the form was first created. Defaults to <tt>false</tt>.
203 trackResetOnLoad : false,
205 <div id="cfg-Ext.form.BasicForm-standardSubmit"></div>/**
206 * @cfg {Boolean} standardSubmit
207 * <p>If set to <tt>true</tt>, standard HTML form submits are used instead
208 * of XHR (Ajax) style form submissions. Defaults to <tt>false</tt>.</p>
209 * <br><p><b>Note:</b> When using <code>standardSubmit</code>, the
210 * <code>options</code> to <code>{@link #submit}</code> are ignored because
211 * Ext's Ajax infrastracture is bypassed. To pass extra parameters (e.g.
212 * <code>baseParams</code> and <code>params</code>), utilize hidden fields
213 * to submit extra data, for example:</p>
216 standardSubmit: true,
220 {@link url}: 'myProcess.php',
228 var fp = this.ownerCt.ownerCt,
230 if (form.isValid()) {
231 // check if there are baseParams and if
232 // hiddent items have been added already
233 if (fp.baseParams && !fp.paramsAdded) {
234 // add hidden items for all baseParams
235 for (i in fp.baseParams) {
239 value: fp.baseParams[i]
243 // set a custom flag to prevent re-adding
244 fp.paramsAdded = true;
246 form.{@link #submit}();
253 <div id="prop-Ext.form.BasicForm-waitMsgTarget"></div>/**
254 * By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
255 * element by passing it or its id or mask the form itself by passing in true.
257 * @property waitMsgTarget
261 initEl : function(el){
262 this.el = Ext.get(el);
263 this.id = this.el.id || Ext.id();
264 if(!this.standardSubmit){
265 this.el.on('submit', this.onSubmit, this);
267 this.el.addClass('x-form');
270 <div id="method-Ext.form.BasicForm-getEl"></div>/**
271 * Get the HTML form Element
272 * @return Ext.Element
279 onSubmit : function(e){
284 destroy: function() {
285 this.items.each(function(f){
289 this.el.removeAllListeners();
292 this.purgeListeners();
295 <div id="method-Ext.form.BasicForm-isValid"></div>/**
296 * Returns true if client-side validation on the form is successful.
299 isValid : function(){
301 this.items.each(function(f){
309 <div id="method-Ext.form.BasicForm-isDirty"></div>/**
310 * <p>Returns true if any fields in this form have changed from their original values.</p>
311 * <p>Note that if this BasicForm was configured with {@link #trackResetOnLoad} then the
312 * Fields' <i>original values</i> are updated when the values are loaded by {@link #setValues}
313 * or {@link #loadRecord}.</p>
316 isDirty : function(){
318 this.items.each(function(f){
327 <div id="method-Ext.form.BasicForm-doAction"></div>/**
328 * Performs a predefined action ({@link Ext.form.Action.Submit} or
329 * {@link Ext.form.Action.Load}) or a custom extension of {@link Ext.form.Action}
330 * to perform application-specific processing.
331 * @param {String/Object} actionName The name of the predefined action type,
332 * or instance of {@link Ext.form.Action} to perform.
333 * @param {Object} options (optional) The options to pass to the {@link Ext.form.Action}.
334 * All of the config options listed below are supported by both the
335 * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
336 * actions unless otherwise noted (custom actions could also accept
337 * other config options):<ul>
339 * <li><b>url</b> : String<div class="sub-desc">The url for the action (defaults
340 * to the form's {@link #url}.)</div></li>
342 * <li><b>method</b> : String<div class="sub-desc">The form method to use (defaults
343 * to the form's method, or POST if not defined)</div></li>
345 * <li><b>params</b> : String/Object<div class="sub-desc"><p>The params to pass
346 * (defaults to the form's baseParams, or none if not defined)</p>
347 * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p></div></li>
349 * <li><b>headers</b> : Object<div class="sub-desc">Request headers to set for the action
350 * (defaults to the form's default headers)</div></li>
352 * <li><b>success</b> : Function<div class="sub-desc">The callback that will
353 * be invoked after a successful response (see top of
354 * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
355 * for a description of what constitutes a successful response).
356 * The function is passed the following parameters:<ul>
357 * <li><tt>form</tt> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
358 * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
359 * <div class="sub-desc">The action object contains these properties of interest:<ul>
360 * <li><tt>{@link Ext.form.Action#response response}</tt></li>
361 * <li><tt>{@link Ext.form.Action#result result}</tt> : interrogate for custom postprocessing</li>
362 * <li><tt>{@link Ext.form.Action#type type}</tt></li>
363 * </ul></div></li></ul></div></li>
365 * <li><b>failure</b> : Function<div class="sub-desc">The callback that will be invoked after a
366 * failed transaction attempt. The function is passed the following parameters:<ul>
367 * <li><tt>form</tt> : The {@link Ext.form.BasicForm} that requested the action.</li>
368 * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
369 * <div class="sub-desc">The action object contains these properties of interest:<ul>
370 * <li><tt>{@link Ext.form.Action#failureType failureType}</tt></li>
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>scope</b> : Object<div class="sub-desc">The scope in which to call the
377 * callback functions (The <tt>this</tt> reference for the callback functions).</div></li>
379 * <li><b>clientValidation</b> : Boolean<div class="sub-desc">Submit Action only.
380 * Determines whether a Form's fields are validated in a final call to
381 * {@link Ext.form.BasicForm#isValid isValid} prior to submission. Set to <tt>false</tt>
382 * to prevent this. If undefined, pre-submission field validation is performed.</div></li></ul>
384 * @return {BasicForm} this
386 doAction : function(action, options){
387 if(Ext.isString(action)){
388 action = new Ext.form.Action.ACTION_TYPES[action](this, options);
390 if(this.fireEvent('beforeaction', this, action) !== false){
391 this.beforeAction(action);
392 action.run.defer(100, action);
397 <div id="method-Ext.form.BasicForm-submit"></div>/**
398 * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Submit submit action}.
399 * @param {Object} options The options to pass to the action (see {@link #doAction} for details).<br>
400 * <p><b>Note:</b> this is ignored when using the {@link #standardSubmit} option.</p>
401 * <p>The following code:</p><pre><code>
402 myFormPanel.getForm().submit({
403 clientValidation: true,
404 url: 'updateConsignment.php',
406 newStatus: 'delivered'
408 success: function(form, action) {
409 Ext.Msg.alert('Success', action.result.msg);
411 failure: function(form, action) {
412 switch (action.failureType) {
413 case Ext.form.Action.CLIENT_INVALID:
414 Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
416 case Ext.form.Action.CONNECT_FAILURE:
417 Ext.Msg.alert('Failure', 'Ajax communication failed');
419 case Ext.form.Action.SERVER_INVALID:
420 Ext.Msg.alert('Failure', action.result.msg);
425 * would process the following server response for a successful submission:<pre><code>
427 "success":true, // note this is Boolean, not string
428 "msg":"Consignment updated"
431 * and the following server response for a failed submission:<pre><code>
433 "success":false, // note this is Boolean, not string
434 "msg":"You do not have permission to perform this operation"
437 * @return {BasicForm} this
439 submit : function(options){
440 if(this.standardSubmit){
441 var v = this.isValid();
443 var el = this.el.dom;
444 if(this.url && Ext.isEmpty(el.action)){
445 el.action = this.url;
451 var submitAction = String.format('{0}submit', this.api ? 'direct' : '');
452 this.doAction(submitAction, options);
456 <div id="method-Ext.form.BasicForm-load"></div>/**
457 * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Load load action}.
458 * @param {Object} options The options to pass to the action (see {@link #doAction} for details)
459 * @return {BasicForm} this
461 load : function(options){
462 var loadAction = String.format('{0}load', this.api ? 'direct' : '');
463 this.doAction(loadAction, options);
467 <div id="method-Ext.form.BasicForm-updateRecord"></div>/**
468 * Persists the values in this form into the passed {@link Ext.data.Record} object in a beginEdit/endEdit block.
469 * @param {Record} record The record to edit
470 * @return {BasicForm} this
472 updateRecord : function(record){
474 var fs = record.fields;
476 var field = this.findField(f.name);
478 record.set(f.name, field.getValue());
485 <div id="method-Ext.form.BasicForm-loadRecord"></div>/**
486 * Loads an {@link Ext.data.Record} into this form by calling {@link #setValues} with the
487 * {@link Ext.data.Record#data record data}.
488 * See also {@link #trackResetOnLoad}.
489 * @param {Record} record The record to load
490 * @return {BasicForm} this
492 loadRecord : function(record){
493 this.setValues(record.data);
498 beforeAction : function(action){
499 var o = action.options;
501 if(this.waitMsgTarget === true){
502 this.el.mask(o.waitMsg, 'x-mask-loading');
503 }else if(this.waitMsgTarget){
504 this.waitMsgTarget = Ext.get(this.waitMsgTarget);
505 this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
507 Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle);
513 afterAction : function(action, success){
514 this.activeAction = null;
515 var o = action.options;
517 if(this.waitMsgTarget === true){
519 }else if(this.waitMsgTarget){
520 this.waitMsgTarget.unmask();
522 Ext.MessageBox.updateProgress(1);
523 Ext.MessageBox.hide();
530 Ext.callback(o.success, o.scope, [this, action]);
531 this.fireEvent('actioncomplete', this, action);
533 Ext.callback(o.failure, o.scope, [this, action]);
534 this.fireEvent('actionfailed', this, action);
538 <div id="method-Ext.form.BasicForm-findField"></div>/**
539 * Find a {@link Ext.form.Field} in this form.
540 * @param {String} id The value to search for (specify either a {@link Ext.Component#id id},
541 * {@link Ext.grid.Column#dataIndex dataIndex}, {@link Ext.form.Field#getName name or hiddenName}).
544 findField : function(id){
545 var field = this.items.get(id);
546 if(!Ext.isObject(field)){
547 this.items.each(function(f){
548 if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
554 return field || null;
558 <div id="method-Ext.form.BasicForm-markInvalid"></div>/**
559 * Mark fields in this form invalid in bulk.
560 * @param {Array/Object} errors Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
561 * @return {BasicForm} this
563 markInvalid : function(errors){
564 if(Ext.isArray(errors)){
565 for(var i = 0, len = errors.length; i < len; i++){
566 var fieldError = errors[i];
567 var f = this.findField(fieldError.id);
569 f.markInvalid(fieldError.msg);
575 if(!Ext.isFunction(errors[id]) && (field = this.findField(id))){
576 field.markInvalid(errors[id]);
583 <div id="method-Ext.form.BasicForm-setValues"></div>/**
584 * Set values for fields in this form in bulk.
585 * @param {Array/Object} values Either an array in the form:<pre><code>
586 [{id:'clientName', value:'Fred. Olsen Lines'},
587 {id:'portOfLoading', value:'FXT'},
588 {id:'portOfDischarge', value:'OSL'} ]</code></pre>
589 * or an object hash of the form:<pre><code>
591 clientName: 'Fred. Olsen Lines',
592 portOfLoading: 'FXT',
593 portOfDischarge: 'OSL'
595 * @return {BasicForm} this
597 setValues : function(values){
598 if(Ext.isArray(values)){ // array of objects
599 for(var i = 0, len = values.length; i < len; i++){
601 var f = this.findField(v.id);
604 if(this.trackResetOnLoad){
605 f.originalValue = f.getValue();
609 }else{ // object hash
612 if(!Ext.isFunction(values[id]) && (field = this.findField(id))){
613 field.setValue(values[id]);
614 if(this.trackResetOnLoad){
615 field.originalValue = field.getValue();
623 <div id="method-Ext.form.BasicForm-getValues"></div>/**
624 * <p>Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
625 * If multiple fields exist with the same name they are returned as an array.</p>
626 * <p><b>Note:</b> The values are collected from all enabled HTML input elements within the form, <u>not</u> from
627 * the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the
628 * value can potentially be the emptyText of a field.</p>
629 * @param {Boolean} asString (optional) Pass true to return the values as a string. (defaults to false, returning an Object)
630 * @return {String/Object}
632 getValues : function(asString){
633 var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
634 if(asString === true){
637 return Ext.urlDecode(fs);
640 <div id="method-Ext.form.BasicForm-getFieldValues"></div>/**
641 * Retrieves the fields in the form as a set of key/value pairs, using the {@link Ext.form.Field#getValue getValue()} method.
642 * If multiple fields exist with the same name they are returned as an array.
643 * @param {Boolean} dirtyOnly (optional) True to return only fields that are dirty.
644 * @return {Object} The values in the form
646 getFieldValues : function(dirtyOnly){
651 this.items.each(function(f){
652 if(dirtyOnly !== true || f.isDirty()){
657 if(Ext.isDefined(key)){
658 if(Ext.isArray(key)){
671 <div id="method-Ext.form.BasicForm-clearInvalid"></div>/**
672 * Clears all invalid messages in this form.
673 * @return {BasicForm} this
675 clearInvalid : function(){
676 this.items.each(function(f){
682 <div id="method-Ext.form.BasicForm-reset"></div>/**
684 * @return {BasicForm} this
687 this.items.each(function(f){
693 <div id="method-Ext.form.BasicForm-add"></div>/**
694 * Add Ext.form Components to this form's Collection. This does not result in rendering of
695 * the passed Component, it just enables the form to validate Fields, and distribute values to
697 * <p><b>You will not usually call this function. In order to be rendered, a Field must be added
698 * to a {@link Ext.Container Container}, usually an {@link Ext.form.FormPanel FormPanel}.
699 * The FormPanel to which the field is added takes care of adding the Field to the BasicForm's
700 * collection.</b></p>
701 * @param {Field} field1
702 * @param {Field} field2 (optional)
703 * @param {Field} etc (optional)
704 * @return {BasicForm} this
707 this.items.addAll(Array.prototype.slice.call(arguments, 0));
712 <div id="method-Ext.form.BasicForm-remove"></div>/**
713 * Removes a field from the items collection (does NOT remove its markup).
714 * @param {Field} field
715 * @return {BasicForm} this
717 remove : function(field){
718 this.items.remove(field);
722 <div id="method-Ext.form.BasicForm-render"></div>/**
723 * Iterates through the {@link Ext.form.Field Field}s which have been {@link #add add}ed to this BasicForm,
724 * checks them for an id attribute, and calls {@link Ext.form.Field#applyToMarkup} on the existing dom element with that id.
725 * @return {BasicForm} this
728 this.items.each(function(f){
729 if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists
730 f.applyToMarkup(f.id);
736 <div id="method-Ext.form.BasicForm-applyToFields"></div>/**
737 * Calls {@link Ext#apply} for all fields in this form with the passed object.
738 * @param {Object} values
739 * @return {BasicForm} this
741 applyToFields : function(o){
742 this.items.each(function(f){
748 <div id="method-Ext.form.BasicForm-applyIfToFields"></div>/**
749 * Calls {@link Ext#applyIf} for all field in this form with the passed object.
750 * @param {Object} values
751 * @return {BasicForm} this
753 applyIfToFields : function(o){
754 this.items.each(function(f){
760 callFieldMethod : function(fnName, args){
762 this.items.each(function(f){
763 if(Ext.isFunction(f[fnName])){
764 f[fnName].apply(f, args);
772 Ext.BasicForm = Ext.form.BasicForm;</pre>
\r