commit extjs-2.2.1
[extjs.git] / docs / output / Ext.form.Action.Submit.html
1         <div class="body-wrap">
2         <div class="top-tools">
3             <a class="inner-link" href="#Ext.form.Action.Submit-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4             <a class="inner-link" href="#Ext.form.Action.Submit-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5             <a class="inner-link" href="#Ext.form.Action.Submit-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                             <a class="inner-link" href="#Ext.form.Action.Submit-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
7                         <a class="bookmark" href="../docs/?class=Ext.form.Action.Submit"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
8         </div>
9                 <div class="inheritance res-block">
10 <pre class="res-block-inner"><a ext:cls="Ext.form.Action" ext:member="" href="output/Ext.form.Action.html">Action</a>
11   <img src="resources/elbow-end.gif"/>Action.Submit</pre></div>
12                 <h1>Class Ext.form.Action.Submit</h1>
13         <table cellspacing="0">
14             <tr><td class="label">Package:</td><td class="hd-info">Ext.form</td></tr>
15             <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/Action.js" target="_blank">Action.js</a></td></tr>
16             <tr><td class="label">Class:</td><td class="hd-info">Action.Submit</td></tr>
17                                     <tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.form.Action" ext:member="" href="output/Ext.form.Action.html">Action</a></td></tr>
18                     </table>
19         <div class="description">
20             <p>A class which handles submission of data from <a ext:cls="Ext.form.BasicForm" href="output/Ext.form.BasicForm.html">Form</a>s
21 and processes the returned response.</p>
22 <p>Instances of this class are only created by a <a ext:cls="Ext.form.BasicForm" href="output/Ext.form.BasicForm.html">Form</a> when
23 <a ext:cls="Ext.form.BasicForm" ext:member="submit" href="output/Ext.form.BasicForm.html#submit">submit</a>ting.</p>
24 <p>A response packet must contain a boolean <tt style="font-weight:bold">success</tt> property, and, optionally
25 an <tt style="font-weight:bold">errors</tt> property. The <tt style="font-weight:bold">errors</tt> property contains error
26 messages for invalid fields.</p>
27 <p>By default, response packets are assumed to be JSON, so a typical response
28 packet may look like this:</p><pre><code>{
29     success: false,
30     errors: {
31         clientCode: <em>"Client not found"</em>,
32         portOfLoading: <em>"This field must not be null"</em>
33     }
34 }</code></pre>
35 <p>Other data may be placed into the response for processing by the <a ext:cls="Ext.form.BasicForm" href="output/Ext.form.BasicForm.html">Ext.form.BasicForm</a>'s callback
36 or event handler methods. The object decoded from this JSON is available in the <a ext:cls="Ext.form.Action.Submit" ext:member="result" href="output/Ext.form.Action.Submit.html#result">result</a> property.</p>
37 <p>Alternatively, if an <a ext:cls="Ext.form.Action.Submit" ext:member="errorReader" href="output/Ext.form.Action.Submit.html#errorReader">errorReader</a> is specified as an <a ext:cls="Ext.data.XmlReader" href="output/Ext.data.XmlReader.html">XmlReader</a>:</p><pre><code>errorReader: <b>new</b> Ext.data.XmlReader({
38             record : <em>'field'</em>,
39             success: <em>'@success'</em>
40         }, [
41             <em>'id'</em>, <em>'msg'</em>
42         ]
43     )</code></pre>
44 <p>then the results may be sent back in XML format:</p><pre><code>&lt;?xml version=<em>"1.0"</em> encoding=<em>"UTF-8"</em>?&gt;
45 &lt;message success=<em>"false"</em>&gt;
46 &lt;errors&gt;
47     &lt;field&gt;
48         &lt;id&gt;clientCode&lt;/id&gt;
49         &lt;msg&gt;&lt;![CDATA[Code not found. &lt;br /&gt;&lt;i&gt;This is a test validation message from the server &lt;/i&gt;]]&gt;&lt;/msg&gt;
50     &lt;/field&gt;
51     &lt;field&gt;
52         &lt;id&gt;portOfLoading&lt;/id&gt;
53         &lt;msg&gt;&lt;![CDATA[Port not found. &lt;br /&gt;&lt;i&gt;This is a test validation message from the server &lt;/i&gt;]]&gt;&lt;/msg&gt;
54     &lt;/field&gt;
55 &lt;/errors&gt;
56 &lt;/message&gt;</code></pre>
57 <p>Other elements may be placed into the response XML for processing by the <a ext:cls="Ext.form.BasicForm" href="output/Ext.form.BasicForm.html">Ext.form.BasicForm</a>'s callback
58 or event handler methods. The XML document is available in the <a ext:cls="Ext.form.Action.Submit" ext:member="errorReader" href="output/Ext.form.Action.Submit.html#errorReader">errorReader</a>'s <a ext:cls="Ext.data.XmlReader" ext:member="xmlData" href="output/Ext.data.XmlReader.html#xmlData">xmlData</a> property.</p>        </div>
59         
60         <div class="hr"></div>
61                 <a id="Ext.form.Action.Submit-configs"></a>
62         <h2>Config Options</h2>
63         <table cellspacing="0" class="member-table">
64             <tr>
65                 <th class="sig-header" colspan="2">Config Options</th>
66                 <th class="msource-header">Defined By</th>
67             </tr>
68                 <tr class="config-row expandable">\r
69         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
70         <td class="sig">\r
71         <a id="Ext.form.Action.Submit-clientValidation"></a>\r
72             <b>clientValidation</b> : boolean            <div class="mdesc">\r
73                         <div class="short">Determines whether a Form's fields are validated in a final call to isValid prior to submission. Pass false in the Fo...</div>\r
74             <div class="long">\r
75                 Determines whether a Form's fields are validated in a final call to <a ext:cls="Ext.form.BasicForm" ext:member="isValid" href="output/Ext.form.BasicForm.html#isValid">isValid</a> prior to submission. Pass <tt>false</tt> in the Form's submit options to prevent this. If not defined, pre-submission field validation is performed.            </div>\r
76                         </div>\r
77         </td>\r
78         <td class="msource">Action.Submit</td>\r
79     </tr>\r
80         <tr class="config-row alt expandable">\r
81         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
82         <td class="sig">\r
83         <a id="Ext.form.Action.Submit-errorReader"></a>\r
84             <b>errorReader</b> : Ext.data.DataReader            <div class="mdesc">\r
85                         <div class="short">Optional. JSON is interpreted with no need for an errorReader. A Reader which reads a single record from the returned...</div>\r
86             <div class="long">\r
87                 <b>Optional. JSON is interpreted with no need for an errorReader.</b> <p>A Reader which reads a single record from the returned data. The DataReader's <b>success</b> property specifies how submission success is determined. The Record's data provides the error messages to apply to any invalid form Fields.</p>.            </div>\r
88                         </div>\r
89         </td>\r
90         <td class="msource">Action.Submit</td>\r
91     </tr>\r
92         <tr class="config-row inherited expandable">\r
93         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
94         <td class="sig">\r
95         <a id="Ext.form.Action.Submit-failure"></a>\r
96             <b>failure</b> : Function            <div class="mdesc">\r
97                         <div class="short">The function to call when a failure packet was recieved, or when an error ocurred in the Ajax communication. The func...</div>\r
98             <div class="long">\r
99                 The function to call when a failure packet was recieved, or when an error ocurred in the Ajax communication. The function is passed the following parameters:<ul class="mdetail-params"> <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li> <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. If an Ajax error ocurred, the failure type will be in <a ext:cls="Ext.form.Action" ext:member="failureType" href="output/Ext.form.Action.html#failureType">failureType</a>. The <a ext:cls="Ext.form.Action" ext:member="result" href="output/Ext.form.Action.html#result">result</a> property of this object may be examined to perform custom postprocessing.</div></li> </ul>            </div>\r
100                         </div>\r
101         </td>\r
102         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#failure" href="output/Ext.form.Action.html#failure">Action</a></td>\r
103     </tr>\r
104         <tr class="config-row inherited alt expandable">\r
105         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
106         <td class="sig">\r
107         <a id="Ext.form.Action.Submit-method"></a>\r
108             <b>method</b> : String            <div class="mdesc">\r
109                         <div class="short">The HTTP method to use to access the requested URL. Defaults to the Ext.form.BasicForm's method, or if that is not sp...</div>\r
110             <div class="long">\r
111                 The HTTP method to use to access the requested URL. Defaults to the <a ext:cls="Ext.form.BasicForm" href="output/Ext.form.BasicForm.html">Ext.form.BasicForm</a>'s method, or if that is not specified, the underlying DOM form's method.            </div>\r
112                         </div>\r
113         </td>\r
114         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#method" href="output/Ext.form.Action.html#method">Action</a></td>\r
115     </tr>\r
116         <tr class="config-row inherited expandable">\r
117         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
118         <td class="sig">\r
119         <a id="Ext.form.Action.Submit-params"></a>\r
120             <b>params</b> : Mixed            <div class="mdesc">\r
121                         <div class="short">Extra parameter values to pass. These are added to the Form's Ext.form.BasicForm.baseParams and passed to the specifi...</div>\r
122             <div class="long">\r
123                 Extra parameter values to pass. These are added to the Form's <a ext:cls="Ext.form.BasicForm" ext:member="baseParams" href="output/Ext.form.BasicForm.html#baseParams">Ext.form.BasicForm.baseParams</a> and passed to the specified URL along with the Form's input fields.            </div>\r
124                         </div>\r
125         </td>\r
126         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#params" href="output/Ext.form.Action.html#params">Action</a></td>\r
127     </tr>\r
128         <tr class="config-row inherited alt expandable">\r
129         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
130         <td class="sig">\r
131         <a id="Ext.form.Action.Submit-reset"></a>\r
132             <b>reset</b> : Boolean            <div class="mdesc">\r
133                         <div class="short">When set to true, causes the Form to be reset on Action success. If specified, this happens before the success callba...</div>\r
134             <div class="long">\r
135                 When set to <tt><b>true</b></tt>, causes the Form to be <a ext:cls="Ext.form.BasicForm.reset" href="output/Ext.form.BasicForm.reset.html">reset</a> on Action success. If specified, this happens <b>before</b> the <a ext:cls="Ext.form.Action" ext:member="success" href="output/Ext.form.Action.html#success">success</a> callback is called and before the Form's <a ext:cls="Ext.form.BasicForm.actioncomplete" href="output/Ext.form.BasicForm.actioncomplete.html">actioncomplete</a> event fires.            </div>\r
136                         </div>\r
137         </td>\r
138         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#reset" href="output/Ext.form.Action.html#reset">Action</a></td>\r
139     </tr>\r
140         <tr class="config-row inherited">\r
141         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
142         <td class="sig">\r
143         <a id="Ext.form.Action.Submit-scope"></a>\r
144             <b>scope</b> : Object            <div class="mdesc">\r
145                             The scope in which to call the callback functions (The <tt>this</tt> reference for the callback functions).                        </div>\r
146         </td>\r
147         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#scope" href="output/Ext.form.Action.html#scope">Action</a></td>\r
148     </tr>\r
149         <tr class="config-row inherited alt expandable">\r
150         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
151         <td class="sig">\r
152         <a id="Ext.form.Action.Submit-success"></a>\r
153             <b>success</b> : Function            <div class="mdesc">\r
154                         <div class="short">The function to call when a valid success return packet is recieved. The function is passed the following parameters:...</div>\r
155             <div class="long">\r
156                 The function to call when a valid success return packet is recieved. The function is passed the following parameters:<ul class="mdetail-params"> <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li> <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. The <a ext:cls="Ext.form.Action" ext:member="result" href="output/Ext.form.Action.html#result">result</a> property of this object may be examined to perform custom postprocessing.</div></li> </ul>            </div>\r
157                         </div>\r
158         </td>\r
159         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#success" href="output/Ext.form.Action.html#success">Action</a></td>\r
160     </tr>\r
161         <tr class="config-row inherited">\r
162         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
163         <td class="sig">\r
164         <a id="Ext.form.Action.Submit-timeout"></a>\r
165             <b>timeout</b> : Number            <div class="mdesc">\r
166                             The number of milliseconds to wait for a server response before failing with the <a ext:cls="Ext.form.Action" ext:member="failureType" href="output/Ext.form.Action.html#failureType">failureType</a> as <a ext:cls="Ext.form.Action" ext:member="Action.CONNECT_FAILURE" href="output/Ext.form.Action.html#Action.CONNECT_FAILURE">Action.CONNECT_FAILURE</a>.                        </div>\r
167         </td>\r
168         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#timeout" href="output/Ext.form.Action.html#timeout">Action</a></td>\r
169     </tr>\r
170         <tr class="config-row inherited alt">\r
171         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
172         <td class="sig">\r
173         <a id="Ext.form.Action.Submit-url"></a>\r
174             <b>url</b> : String            <div class="mdesc">\r
175                             The URL that the Action is to invoke.                        </div>\r
176         </td>\r
177         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#url" href="output/Ext.form.Action.html#url">Action</a></td>\r
178     </tr>\r
179         <tr class="config-row inherited">\r
180         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
181         <td class="sig">\r
182         <a id="Ext.form.Action.Submit-waitMsg"></a>\r
183             <b>waitMsg</b> : String            <div class="mdesc">\r
184                             The message to be displayed by a call to <a ext:cls="Ext.MessageBox" ext:member="wait" href="output/Ext.MessageBox.html#wait">Ext.MessageBox.wait</a> during the time the action is being processed.                        </div>\r
185         </td>\r
186         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#waitMsg" href="output/Ext.form.Action.html#waitMsg">Action</a></td>\r
187     </tr>\r
188         <tr class="config-row inherited alt">\r
189         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
190         <td class="sig">\r
191         <a id="Ext.form.Action.Submit-waitTitle"></a>\r
192             <b>waitTitle</b> : String            <div class="mdesc">\r
193                             The title to be displayed by a call to <a ext:cls="Ext.MessageBox" ext:member="wait" href="output/Ext.MessageBox.html#wait">Ext.MessageBox.wait</a> during the time the action is being processed.                        </div>\r
194         </td>\r
195         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#waitTitle" href="output/Ext.form.Action.html#waitTitle">Action</a></td>\r
196     </tr>\r
197             </table>
198                 <a id="Ext.form.Action.Submit-props"></a>
199         <h2>Public Properties</h2>
200                 <table cellspacing="0" class="member-table">
201             <tr>
202                 <th class="sig-header" colspan="2">Property</th>
203                 <th class="msource-header">Defined By</th>
204             </tr>
205                 <tr class="property-row inherited expandable">\r
206         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
207         <td class="sig">\r
208         <a id="Ext.form.Action.Submit-failureType"></a>\r
209             <b>failureType</b> : String            <div class="mdesc">\r
210                         <div class="short">The type of failure detected. See Ext.form.Action#Action.CLIENT_INVALID CLIENT_INVALID,
211 Ext.form.Action#Action.SERVER...</div>\r
212             <div class="long">\r
213                 The type of failure detected. See <a ext:cls="link" href="output/link.html">Ext.form.Action#Action.CLIENT_INVALID CLIENT_INVALID</a>,
214 <a ext:cls="link" href="output/link.html">Ext.form.Action#Action.SERVER_INVALID SERVER_INVALID</a>,
215 <a ext:cls="Ext.form.Action" ext:member="link" href="output/Ext.form.Action.html#link">Ext.form.ActionAction.CONNECT_FAILURE CONNECT_FAILURE</a>, {@link Ext.form.Action#Action.LOAD_FAILURE LOAD_FAILURE}            </div>\r
216                         </div>\r
217         </td>\r
218         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#failureType" href="output/Ext.form.Action.html#failureType">Action</a></td>\r
219     </tr>\r
220         <tr class="property-row inherited alt">\r
221         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
222         <td class="sig">\r
223         <a id="Ext.form.Action.Submit-response"></a>\r
224             <b>response</b> : Object            <div class="mdesc">\r
225                             
226 The XMLHttpRequest object used to perform the action.                        </div>\r
227         </td>\r
228         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#response" href="output/Ext.form.Action.html#response">Action</a></td>\r
229     </tr>\r
230         <tr class="property-row inherited">\r
231         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
232         <td class="sig">\r
233         <a id="Ext.form.Action.Submit-result"></a>\r
234             <b>result</b> : Object            <div class="mdesc">\r
235                             
236 The decoded response object containing a boolean <tt style="font-weight:bold">success</tt> property and
237 other, action-specific properties.                        </div>\r
238         </td>\r
239         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#result" href="output/Ext.form.Action.html#result">Action</a></td>\r
240     </tr>\r
241         <tr class="property-row inherited alt">\r
242         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
243         <td class="sig">\r
244         <a id="Ext.form.Action.Submit-type"></a>\r
245             <b>type</b> : String            <div class="mdesc">\r
246                             
247 The type of action this Action instance performs.
248 Currently only "submit" and "load" are supported.                        </div>\r
249         </td>\r
250         <td class="msource"><a ext:cls="Ext.form.Action" ext:member="#type" href="output/Ext.form.Action.html#type">Action</a></td>\r
251     </tr>\r
252             </table>
253                 <a id="Ext.form.Action.Submit-methods"></a>
254         <h2>Public Methods</h2>
255         <div class="no-members">This class has no public methods.</div>        <a id="Ext.form.Action.Submit-events"></a>
256         <h2>Public Events</h2>
257         <div class="no-members">This class has no public events.</div>
258         </div>