Clear Up
SharpKit Reference

Action Class

The subclasses of this class provide actions to perform upon Forms.

Instances of this class are only created by a Form when the Form needs to perform an action such as submit or load. The Configuration options listed for this class are set through the Form's action methods: submit, load and doAction

The instance of Action which performed the action is passed to the success and failure callbacks of the Form's action methods (submit, load and doAction), and to the actioncomplete and actionfailed event handlers.

Namespace: Ext.form.action

Base Types


Name Description
Action(object) Creates new Action.


Name Description
CLIENT_INVALID Failure type returned when client side validation of the Form fails thus aborting a submit action. Client side validation is performed unless Ext.form.action.Submit.clientValidation is explicitly set to false. Defaults to: "client"
CONNECT_FAILURE Failure type returned when a communication error happens when attempting to send a request to the remote server. The response may be examined to provide further information. Defaults to: "connect"
failureType The type of failure detected will be one of these: CLIENT_INVALID, SERVER_INVALID, CONNECT_FAILURE, or LOAD_FAILURE. Usage:
var fp = new Ext.form.Panel({
            buttons: [{
            text: 'Save',
            formBind: true,
            handler: function(){
            url: 'form-submit.php',
            waitMsg: 'Submitting your data...',
            success: function(form, action){
            // server responded with success = true
            var result = action.result;
            failure: function(form, action){
            if (action.failureType === Ext.form.action.Action.CONNECT_FAILURE) {
            'Status:'+action.response.status+': '+
            if (action.failureType === Ext.form.action.Action.SERVER_INVALID){
            // server responded with success = false
            Ext.Msg.alert('Invalid', action.result.errormsg);
            text: 'Reset',
            handler: function(){
LOAD_FAILURE Failure type returned when the response's success property is set to false, or no field values are returned in the response's data property. Defaults to: "load"
response The raw XMLHttpRequest object used to perform the action.
result The decoded response object containing a boolean success property and other, action-specific properties.
SERVER_INVALID Failure type returned when server side processing fails and the result's success property is set to false. In the case of a form submission, field-specific error messages may be returned in the result's errors property. Defaults to: "server"
type The type of action this Action instance performs. Currently only "submit" and "load" are supported.


Name Description
failure The function to call when a failure packet was received, or when an error ocurred in the Ajax communication.
form The BasicForm instance that is invoking this Action. Required.
headers Extra headers to be sent in the AJAX request for submit and load actions. See
method The HTTP method to use to access the requested URL. Defaults to the BasicForm's method, or 'POST' if not specified.
params Extra parameter values to pass. These are added to the Form's Ext.form.Basic.baseParams and passed to the specified URL along with the Form's input fields. Parameters are encoded as standard HTTP parameters using Ext.Object.toQueryString.
reset When set to true, causes the Form to be reset on Action success. If specified, this happens before the success callback is called and before the Form's actioncomplete event fires.
scope The scope in which to call the configured success and failure callback functions (the this reference for the callback functions).
submitEmptyText If set to true, the emptyText value will be sent with the form when it is submitted. Defaults to: true
success The function to call when a valid success return packet is received.
timeout The number of seconds to wait for a server response before failing with the failureType as CONNECT_FAILURE. If not specified, defaults to the configured timeout of the form.
url The URL that the Action is to invoke. Will default to the url configured on the form.
waitMsg The message to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.
waitTitle The title to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.


Name Description
run() Invokes this action using the current configuration.
© Copyright 2005-2011 SharpKit. All rights reserved.