For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.form.action.DirectLoad

####

    HierarchyExt.BaseExt.form.action.ActionExt.form.action.LoadExt.form.action.DirectLoad

Provides Ext.direct.Manager support for loading form data.

This example illustrates usage of Ext.direct.Direct to load a form through Ext.Direct.

    var myFormPanel = new Ext.form.Panel({
        // configs for FormPanel
        title: 'Basic Information',
        renderTo: document.body,
        width: 300, height: 160,
        padding: 10,

        // configs apply to child items
        defaults: {anchor: '100%'},
        defaultType: 'textfield',
        items: [{
            fieldLabel: 'Name',
            name: 'name'
        },{
            fieldLabel: 'Email',
            name: 'email'
        },{
            fieldLabel: 'Company',
            name: 'company'
        }],

        // configs for BasicForm
        api: {
            // The server-side method to call for load() requests
            load: Profile.getBasicInfo,
            // The server-side must mark the submit handler as a 'formHandler'
            submit: Profile.updateBasicInfo
        },
        // specify the order for the passed params
        paramOrder: ['uid', 'foo']
    });

    // load the form
    myFormPanel.getForm().load({
        // pass 2 arguments to server side getBasicInfo method (len=2)
        params: {
            foo: 'bar',
            uid: 34
        }
    });

The data packet sent to the server will resemble something like:

    [
        {
            "action":"Profile","method":"getBasicInfo","type":"rpc","tid":2,
            "data":[34,"bar"] // note the order of the params
        }
    ]

The form will process a data packet returned by the server that is similar to the following format:

    [
        {
            "action":"Profile","method":"getBasicInfo","type":"rpc","tid":2,
            "result":{
                "success":true,
                "data":{
                    "name":"Fred Flintstone",
                    "company":"Slate Rock and Gravel",
                    "email":"fred.flintstone@slaterg.com"
                }
            }
        }
    ]

Defined By

### Config Options

#### Other Configs

Ext.form.action.Action
view source
failure : Function
The function to call when a failure packet was received, or when an error ocurred in the Ajax communication. The func...

The function to call when a failure packet was received, or when an error ocurred in the Ajax communication. The function is passed the following parameters:

- form : Ext.form.Basic
  The form that requested the action
- action : Ext.form.action.Action
  The Action class. If an Ajax error ocurred, the failure type will be in failureType. The result property of this object may be examined to perform custom postprocessing.

Ext.form.action.Action
view source
form : Ext.form.Basic

The BasicForm instance that is invoking this Action. Required.

The BasicForm instance that is invoking this Action. Required.

Ext.form.action.Action
view source
headers : Object

Extra headers to be sent in the AJAX request for submit and load actions. See Ext.data.Connection.headers.

Extra headers to be sent in the AJAX request for submit and load actions. See Ext.data.Connection.headers.

Ext.form.action.Action
view source
method : String

The HTTP method to use to access the requested URL. Defaults to the BasicForm's method, or 'POST' if not specified.

The HTTP method to use to access the requested URL. Defaults to the BasicForm's method, or 'POST' if not specified.

Ext.form.action.Action
view source
params : Object/String
Extra parameter values to pass. These are added to the Form's Ext.form.Basic.baseParams and passed to the specified U...

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.

Ext.form.action.Action
view source
reset : Boolean
When set to true, causes the Form to be reset on Action success. If specified, this happens before the success callba...

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.

Ext.form.action.Action
view source
scope : Object
The scope in which to call the configured success and failure callback functions (the this reference for the callback...

The scope in which to call the configured `success` and `failure` callback functions (the `this` reference for the callback functions).

Ext.form.action.Action
view source
submitEmptyText : Boolean

If set to `true`, the emptyText value will be sent with the form when it is submitted. Defaults to `true`.

If set to `true`, the emptyText value will be sent with the form when it is submitted. Defaults to `true`.

Ext.form.action.Action
view source
success : Function
The function to call when a valid success return packet is received. The function is passed the following parameters:...

The function to call when a valid success return packet is received. The function is passed the following parameters:

- form : Ext.form.Basic
  The form that requested the action
- action : Ext.form.action.Action
  The Action class. The result property of this object may be examined to perform custom postprocessing.

Ext.form.action.Action
view source
timeout : Number
The number of seconds to wait for a server response before failing with the failureType as Ext.form.action.Action.CON...

The number of seconds to wait for a server response before failing with the failureType as Ext.form.action.Action.CONNECT_FAILURE. If not specified, defaults to the configured `timeout` of the form.

Ext.form.action.Action
view source
url : String

The URL that the Action is to invoke. Will default to the url configured on the form.

The URL that the Action is to invoke. Will default to the url configured on the form.

Ext.form.action.Action
view source
waitMsg : String

The message to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.

The message to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.

Ext.form.action.Action
view source
waitTitle : String

The title to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.

The title to be displayed by a call to Ext.window.MessageBox.wait during the time the action is being processed.

Defined By

### Properties

Ext.form.action.Action
view source
CLIENT_INVALID : String
Failure type returned when client side validation of the Form fails thus aborting a submit action. Client side valida...

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`.

Ext.form.action.Action
view source
CONNECT_FAILURE : String
Failure type returned when a communication error happens when attempting to send a request to the remote server. The ...

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.

Ext.form.action.Action
view source
LOAD_FAILURE : String
Failure type returned when the response's success property is set to false, or no field values are returned in the re...

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.

Ext.form.action.Action
view source
SERVER_INVALID : String
Failure type returned when server side processing fails and the result's success property is set to false. In the c...

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.

Ext.Base
view source
addStatics : Function
Add / override static properties of this class. Ext.define('My.cool.Class', { ... }); My.cool.Class.addStatics(...

Add / override static properties of this class.

    Ext.define('My.cool.Class', {
        ...
    });

    My.cool.Class.addStatics({
        someProperty: 'someValue',      // My.cool.Class.someProperty = 'someValue'
        method1: function() { ... },    // My.cool.Class.method1 = function() { ... };
        method2: function() { ... }     // My.cool.Class.method2 = function() { ... };
    });

Ext.Base
view source
borrow : Function
Borrow another class' members to the prototype of this class. Ext.define('Bank', { money: '$$$', printMoney: functi...

Borrow another class' members to the prototype of this class.

Ext.define('Bank', {

    money: '$$$',
    printMoney: function() {
        alert('$$$$$$$');
    }

});

Ext.define('Thief', {

    ...

});

Thief.borrow(Bank, ['money', 'printMoney']);

var steve = new Thief();

alert(steve.money); // alerts '$$$' steve.printMoney(); // alerts '$$$$$$$'

Ext.Base
view source
create : Function
Create a new instance of this Class. Ext.define('My.cool.Class', { ... }); My.cool.Class.create({ someConfig: tr...

Create a new instance of this Class. Ext.define('My.cool.Class', {

    ...

});

My.cool.Class.create({

    someConfig: true

});

Ext.Base
view source
createAlias : Function
Create aliases for existing prototype methods. Example: Ext.define('My.cool.Class', { method1: function() { ... ...

Create aliases for existing prototype methods. Example:

    Ext.define('My.cool.Class', {
        method1: function() { ... },
        method2: function() { ... }
    });

    var test = new My.cool.Class();

    My.cool.Class.createAlias({
        method3: 'method1',
        method4: 'method2'
    });

    test.method3(); // test.method1()

    My.cool.Class.createAlias('method5', 'method3');

    test.method5(); // test.method3() -> test.method1()

Ext.form.action.Action
view source
failureType : String
The type of failure detected will be one of these: Ext.form.action.Action.CLIENT_INVALID, Ext.form.action.Action.SERV...

The type of failure detected will be one of these: Ext.form.action.Action.CLIENT_INVALID, Ext.form.action.Action.SERVER_INVALID, Ext.form.action.Action.CONNECT_FAILURE, or Ext.form.action.Action.LOAD_FAILURE. Usage:

    var fp = new Ext.form.Panel({
    ...
    buttons: [{
        text: 'Save',
        formBind: true,
        handler: function(){
            if(fp.getForm().isValid()){
                fp.getForm().submit({
                    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) {
                            Ext.Msg.alert('Error',
                                'Status:'+action.response.status+': '+
                                action.response.statusText);
                        }
                        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(){
            fp.getForm().reset();
        }
    }]

Ext.Base
view source
implement : Function
Add methods / properties to the prototype of this class. Ext.define('My.awesome.Cat', { constructor: function() ...

Add methods / properties to the prototype of this class.

    Ext.define('My.awesome.Cat', {
        constructor: function() {
            ...
        }
    });

     My.awesome.Cat.implement({
         meow: function() {
            alert('Meowww...');
         }
     });

     var kitty = new My.awesome.Cat;
     kitty.meow();

Ext.Base
view source
override : Function
Override prototype members of this class. Overridden methods can be invoked via Ext.Base.callOverridden Ext.define('...

Override prototype members of this class. Overridden methods can be invoked via Ext.Base.callOverridden

    Ext.define('My.Cat', {
        constructor: function() {
            alert("I'm a cat!");

            return this;
        }
    });

    My.Cat.override({
        constructor: function() {
            alert("I'm going to be a cat!");

            var instance = this.callOverridden();

            alert("Meeeeoooowwww");

            return instance;
        }
    });

    var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
                              // alerts "I'm a cat!"
                              // alerts "Meeeeoooowwww"

Ext.form.action.Action
view source
response : Object

The raw XMLHttpRequest object used to perform the action.

The raw XMLHttpRequest object used to perform the action.

Ext.form.action.Action
view source
result : Object

The decoded response object containing a boolean `success` property and other, action-specific properties.

The decoded response object containing a boolean `success` property and other, action-specific properties.

Ext.form.action.Action
view source
run : Object

Invokes this action using the current configuration.

Invokes this action using the current configuration.

Ext.form.action.Action
view source
type : String

The type of action this Action instance performs. Currently only "submit" and "load" are supported.

The type of action this Action instance performs. Currently only "submit" and "load" are supported.

Defined By

### Methods

Ext.form.action.Action
view source
DirectLoad( Object config) : void

### Parameters

- config : Object

  The configuration for this instance.

### Returns

- void

Ext.Base
view source
callOverridden( Array/Arguments args) : Mixed
Call the original method that was previously overridden with Ext.Base.override Ext.define('My.Cat', { constructo...

Call the original method that was previously overridden with Ext.Base.override

    Ext.define('My.Cat', {
        constructor: function() {
            alert("I'm a cat!");

            return this;
        }
    });

    My.Cat.override({
        constructor: function() {
            alert("I'm going to be a cat!");

            var instance = this.callOverridden();

            alert("Meeeeoooowwww");

            return instance;
        }
    });

    var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
                              // alerts "I'm a cat!"
                              // alerts "Meeeeoooowwww"

### Parameters

- args : Array/Arguments

  The arguments, either an array or the `arguments` object

### Returns

- Mixed

  Returns the result after calling the overridden method

Ext.Base
view source
getName : String
Get the current class' name in string format. Ext.define('My.cool.Class', { constructor: function() { al...

Get the current class' name in string format.

    Ext.define('My.cool.Class', {
        constructor: function() {
            alert(this.self.getName()); // alerts 'My.cool.Class'
        }
    });

    My.cool.Class.getName(); // 'My.cool.Class'

### Returns

- String

  className