Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / output / Ext.form.Action.html
1 <div class="body-wrap" xmlns:ext="http://www.extjs.com"><div class="top-tools"><a class="inner-link" href="#Ext.form.Action-props"><img src="resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>&#13;<a class="inner-link" href="#Ext.form.Action-methods"><img src="resources/images/default/s.gif" class="item-icon icon-method">Methods</a>&#13;<a class="inner-link" href="#Ext.form.Action-events"><img src="resources/images/default/s.gif" class="item-icon icon-event">Events</a>&#13;<a class="inner-link" href="#Ext.form.Action-configs"><img src="resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>&#13;<a class="bookmark" href="../docs/?class=Ext.form.Action"><img src="resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>&#13;</div><h1>Class <a href="source/Action1.html#cls-Ext.form.Action">Ext.form.Action</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext.form</td></tr><tr><td class="label">Defined In:</td><td class="hd-info">Action.js</td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/Action1.html#cls-Ext.form.Action">Action</a></td></tr><tr><td class="label">Subclasses:</td><td class="hd-info"><a href="output/Ext.form.Action.Load.html" ext:cls="Ext.form.Action.Load">Action.Load</a>,&#13;<a href="output/Ext.form.Action.Submit.html" ext:cls="Ext.form.Action.Submit">Action.Submit</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr><tr><td class="hd-info"></td></tr></table><div class="description"><p>The subclasses of this class provide actions to perform upon <a href="output/Ext.form.BasicForm.html" ext:cls="Ext.form.BasicForm">Form</a>s.</p>\r
2 <p>Instances of this class are only created by a <a href="output/Ext.form.BasicForm.html" ext:cls="Ext.form.BasicForm">Form</a> when\r
3 the Form needs to perform an action such as submit or load. The Configuration options\r
4 listed for this class are set through the Form's action methods: <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-submit" ext:member="submit" ext:cls="Ext.form.BasicForm">submit</a>,\r
5 <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-load" ext:member="load" ext:cls="Ext.form.BasicForm">load</a> and <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-doAction" ext:member="doAction" ext:cls="Ext.form.BasicForm">doAction</a></p>\r
6 <p>The instance of Action which performed the action is passed to the success\r
7 and failure callbacks of the Form's action methods (<a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-submit" ext:member="submit" ext:cls="Ext.form.BasicForm">submit</a>,\r
8 <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-load" ext:member="load" ext:cls="Ext.form.BasicForm">load</a> and <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-doAction" ext:member="doAction" ext:cls="Ext.form.BasicForm">doAction</a>),\r
9 and to the <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-actioncomplete" ext:member="actioncomplete" ext:cls="Ext.form.BasicForm">actioncomplete</a> and\r
10 <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-actionfailed" ext:member="actionfailed" ext:cls="Ext.form.BasicForm">actionfailed</a> event handlers.</p></div><div class="hr"></div><a id="Ext.form.Action-configs"></a><h2>Config Options</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Config Options</th><th class="msource-header">Defined By</th></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-failure"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-failure">failure</a></b> : Function<div class="mdesc"><div class="short">The function to call when a failure packet was recieved, or when an&#13;\r
11 error ocurred in the Ajax communication.&#13;\r
12 The fu...</div><div class="long">The function to call when a failure packet was recieved, or when an\r
13 error ocurred in the Ajax communication.\r
14 The function is passed the following parameters:<ul class="mdetail-params">\r
15 <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>\r
16 <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. If an Ajax\r
17 error ocurred, the failure type will be in <a href="output/Ext.form.Action.html#Ext.form.Action-failureType" ext:member="failureType" ext:cls="Ext.form.Action">failureType</a>. The <a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>\r
18 property of this object may be examined to perform custom postprocessing.</div></li>\r
19 </ul></div></div></td><td class="msource">Action</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-method"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-method">method</a></b> : String<div class="mdesc"><div class="short">The HTTP method to use to access the requested URL. Defaults to the&#13;\r
20 Ext.form.BasicForm's method, or if that is not s...</div><div class="long">The HTTP method to use to access the requested URL. Defaults to the\r
21 <a href="output/Ext.form.BasicForm.html" ext:cls="Ext.form.BasicForm">Ext.form.BasicForm</a>'s method, or if that is not specified, the underlying DOM form's method.</div></div></td><td class="msource">Action</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-params"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-params">params</a></b> : Mixed<div class="mdesc"><div class="short">Extra parameter values to pass. These are added to the Form's&#13;\r
22 Ext.form.BasicForm.baseParams and passed to the specif...</div><div class="long"><p>Extra parameter values to pass. These are added to the Form's\r
23 <a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-baseParams" ext:member="baseParams" ext:cls="Ext.form.BasicForm">Ext.form.BasicForm.baseParams</a> and passed to the specified URL along with the Form's\r
24 input fields.</p>\r
25 <p>Parameters are encoded as standard HTTP parameters using <a href="output/Ext.html#Ext-urlEncode" ext:member="urlEncode" ext:cls="Ext">Ext.urlEncode</a>.</p></div></div></td><td class="msource">Action</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-reset"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-reset">reset</a></b> : Boolean<div class="mdesc"><div class="short">When set to true, causes the Form to be&#13;\r
26 reset on Action success. If specified, this happens&#13;\r
27 before the success call...</div><div class="long">When set to <tt><b>true</b></tt>, causes the Form to be\r
28 <a href="output/Ext.form.BasicForm.reset.html" ext:cls="Ext.form.BasicForm.reset">reset</a> on Action success. If specified, this happens\r
29 <b>before</b> the <a href="output/Ext.form.Action.html#Ext.form.Action-success" ext:member="success" ext:cls="Ext.form.Action">success</a> callback is called and before the Form's\r
30 <a href="output/Ext.form.BasicForm.actioncomplete.html" ext:cls="Ext.form.BasicForm.actioncomplete">actioncomplete</a> event fires.</div></div></td><td class="msource">Action</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-scope"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-scope">scope</a></b> : Object<div class="mdesc">The scope in which to call the callback functions (The <tt>this</tt> reference\r
31 for the callback functions).</div></td><td class="msource">Action</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-success"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-success">success</a></b> : Function<div class="mdesc"><div class="short">The function to call when a valid success return packet is recieved.&#13;\r
32 The function is passed the following parameters...</div><div class="long">The function to call when a valid success return packet is recieved.\r
33 The function is passed the following parameters:<ul class="mdetail-params">\r
34 <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>\r
35 <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. The <a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>\r
36 property of this object may be examined to perform custom postprocessing.</div></li>\r
37 </ul></div></div></td><td class="msource">Action</td></tr><tr class="config-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-timeout"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-timeout">timeout</a></b> : Number<div class="mdesc"><div class="short">The number of seconds to wait for a server response before&#13;\r
38 failing with the failureType as Action.CONNECT_FAILURE. I...</div><div class="long">The number of seconds to wait for a server response before\r
39 failing with the <a href="output/Ext.form.Action.html#Ext.form.Action-failureType" ext:member="failureType" ext:cls="Ext.form.Action">failureType</a> as <a href="output/Ext.form.Action.html#Ext.form.Action-Action.CONNECT_FAILURE" ext:member="Action.CONNECT_FAILURE" ext:cls="Ext.form.Action">Action.CONNECT_FAILURE</a>. If not specified,\r
40 defaults to the configured <tt><a href="output/Ext.form.BasicForm.html#Ext.form.BasicForm-timeout" ext:member="timeout" ext:cls="Ext.form.BasicForm">timeout</a></tt> of the\r
41 <a href="output/Ext.form.BasicForm.html" ext:cls="Ext.form.BasicForm">form</a>.</div></div></td><td class="msource">Action</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-url"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-url">url</a></b> : String<div class="mdesc">The URL that the Action is to invoke.</div></td><td class="msource">Action</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-waitMsg"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-waitMsg">waitMsg</a></b> : String<div class="mdesc">The message to be displayed by a call to <a href="output/Ext.MessageBox.html#Ext.MessageBox-wait" ext:member="wait" ext:cls="Ext.MessageBox">Ext.MessageBox.wait</a>\r
42 during the time the action is being processed.</div></td><td class="msource">Action</td></tr><tr class="config-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-waitTitle"></a><b><a href="source/Action1.html#cfg-Ext.form.Action-waitTitle">waitTitle</a></b> : String<div class="mdesc">The title to be displayed by a call to <a href="output/Ext.MessageBox.html#Ext.MessageBox-wait" ext:member="wait" ext:cls="Ext.MessageBox">Ext.MessageBox.wait</a>\r
43 during the time the action is being processed.</div></td><td class="msource">Action</td></tr></tbody></table><a id="Ext.form.Action-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-CLIENT_INVALID"></a><b><a href="source/Action1.html#prop-Ext.form.Action-CLIENT_INVALID">CLIENT_INVALID</a></b> : String<div class="mdesc"><div class="short">Failure type returned when client side validation of the Form fails&#13;\r
44 thus aborting a submit action. Client side valid...</div><div class="long">Failure type returned when client side validation of the Form fails\r
45 thus aborting a submit action. Client side validation is performed unless\r
46 <a href="output/Ext.form.Action.html#Ext.form.Action-clientValidation" ext:member="clientValidation" ext:cls="Ext.form.Action">clientValidation</a> is explicitly set to <tt>false</tt>.</div></div></td><td class="msource">Action</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-CONNECT_FAILURE"></a><b><a href="source/Action1.html#prop-Ext.form.Action-CONNECT_FAILURE">CONNECT_FAILURE</a></b> : String<div class="mdesc"><div class="short">Failure type returned when a communication error happens when attempting&#13;\r
47 to send a request to the remote server. The...</div><div class="long">Failure type returned when a communication error happens when attempting\r
48 to send a request to the remote server. The <a href="output/Ext.form.Action.html#Ext.form.Action-response" ext:member="response" ext:cls="Ext.form.Action">response</a> may be examined to\r
49 provide further information.</div></div></td><td class="msource">Action</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-LOAD_FAILURE"></a><b><a href="source/Action1.html#prop-Ext.form.Action-LOAD_FAILURE">LOAD_FAILURE</a></b> : String<div class="mdesc"><div class="short">Failure type returned when the response's &lt;tt style="font-weight:bold"&gt;success&#13;\r
50 property is set to false, or no field...</div><div class="long">Failure type returned when the response's <tt style="font-weight:bold">success</tt>\r
51 property is set to <tt>false</tt>, or no field values are returned in the response's\r
52 <tt style="font-weight:bold">data</tt> property.</div></div></td><td class="msource">Action</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-SERVER_INVALID"></a><b><a href="source/Action1.html#prop-Ext.form.Action-SERVER_INVALID">SERVER_INVALID</a></b> : String<div class="mdesc"><div class="short">Failure type returned when server side processing fails and the result's&#13;\r
53 &lt;tt style="font-weight:bold"&gt;success proper...</div><div class="long"><p>Failure type returned when server side processing fails and the <a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>'s\r
54 <tt style="font-weight:bold">success</tt> property is set to <tt>false</tt>.</p>\r
55 <p>In the case of a form submission, field-specific error messages may be returned in the\r
56 <a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>'s <tt style="font-weight:bold">errors</tt> property.</p></div></div></td><td class="msource">Action</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-failureType"></a><b><a href="source/Action1.html#prop-Ext.form.Action-failureType">failureType</a></b> : String<div class="mdesc"><div class="short">The type of failure detected will be one of these: CLIENT_INVALID,&#13;\r
57 SERVER_INVALID, CONNECT_FAILURE, or LOAD_FAILURE....</div><div class="long">The type of failure detected will be one of these: <a href="output/Ext.form.Action.html#Ext.form.Action-CLIENT_INVALID" ext:member="CLIENT_INVALID" ext:cls="Ext.form.Action">CLIENT_INVALID</a>,\r
58 <a href="output/Ext.form.Action.html#Ext.form.Action-SERVER_INVALID" ext:member="SERVER_INVALID" ext:cls="Ext.form.Action">SERVER_INVALID</a>, <a href="output/Ext.form.Action.html#Ext.form.Action-CONNECT_FAILURE" ext:member="CONNECT_FAILURE" ext:cls="Ext.form.Action">CONNECT_FAILURE</a>, or <a href="output/Ext.form.Action.html#Ext.form.Action-LOAD_FAILURE" ext:member="LOAD_FAILURE" ext:cls="Ext.form.Action">LOAD_FAILURE</a>.  Usage:\r
59 <pre><code><b>var</b> fp = <b>new</b> Ext.form.FormPanel({\r
60 ...\r
61 buttons: [{\r
62     text: <em>'Save'</em>,\r
63     formBind: true,\r
64     handler: <b>function</b>(){\r
65         <b>if</b>(fp.getForm().isValid()){\r
66             fp.getForm().submit({\r
67                 url: <em>'form-submit.php'</em>,\r
68                 waitMsg: <em>'Submitting your data...'</em>,\r
69                 success: <b>function</b>(form, action){\r
70                     <i>// server responded <b>with</b> success = true\r</i>
71                     <b>var</b> result = action.<a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>;\r
72                 },\r
73                 failure: <b>function</b>(form, action){\r
74                     <b>if</b> (action.<a href="output/Ext.form.Action.html#Ext.form.Action-failureType" ext:member="failureType" ext:cls="Ext.form.Action">failureType</a> === Ext.form.Action.<a href="output/Ext.form.Action.html#Ext.form.Action-CONNECT_FAILURE" ext:member="CONNECT_FAILURE" ext:cls="Ext.form.Action">CONNECT_FAILURE</a>) {\r
75                         Ext.Msg.alert(<em>'Error'</em>,\r
76                             <em>'Status:'</em>+action.<a href="output/Ext.form.Action.html#Ext.form.Action-response" ext:member="response" ext:cls="Ext.form.Action">response</a>.status+<em>': '</em>+\r
77                             action.<a href="output/Ext.form.Action.html#Ext.form.Action-response" ext:member="response" ext:cls="Ext.form.Action">response</a>.statusText);\r
78                     }\r
79                     <b>if</b> (action.failureType === Ext.form.Action.<a href="output/Ext.form.Action.html#Ext.form.Action-SERVER_INVALID" ext:member="SERVER_INVALID" ext:cls="Ext.form.Action">SERVER_INVALID</a>){\r
80                         <i>// server responded <b>with</b> success = false\r</i>
81                         Ext.Msg.alert(<em>'Invalid'</em>, action.<a href="output/Ext.form.Action.html#Ext.form.Action-result" ext:member="result" ext:cls="Ext.form.Action">result</a>.errormsg);\r
82                     }\r
83                 }\r
84             });\r
85         }\r
86     }\r
87 },{\r
88     text: <em>'Reset'</em>,\r
89     handler: <b>function</b>(){\r
90         fp.getForm().reset();\r
91     }\r
92 }]</code></pre></div></div></td><td class="msource">Action</td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-response"></a><b><a href="source/Action1.html#prop-Ext.form.Action-response">response</a></b> : Object<div class="mdesc">The XMLHttpRequest object used to perform the action.</div></td><td class="msource">Action</td></tr><tr class="property-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-result"></a><b><a href="source/Action1.html#prop-Ext.form.Action-result">result</a></b> : Object<div class="mdesc"><div class="short">The decoded response object containing a boolean &lt;tt style="font-weight:bold"&gt;success property and&#13;\r
93 other, action-spe...</div><div class="long">The decoded response object containing a boolean <tt style="font-weight:bold">success</tt> property and\r
94 other, action-specific properties.</div></div></td><td class="msource">Action</td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.form.Action-type"></a><b><a href="source/Action1.html#prop-Ext.form.Action-type">type</a></b> : String<div class="mdesc">The type of action this Action instance performs.\r
95 Currently only "submit" and "load" are supported.</div></td><td class="msource">Action</td></tr></tbody></table><a id="Ext.form.Action-methods"></a><h2>Public Methods</h2><div class="no-members">This class has no public methods.</div><a id="Ext.form.Action-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>