X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/530ef4b6c5b943cfa68b779d11cf7de29aa878bf..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/api/Ext.form.action.Submit.html diff --git a/docs/api/Ext.form.action.Submit.html b/docs/api/Ext.form.action.Submit.html new file mode 100644 index 00000000..17597dc7 --- /dev/null +++ b/docs/api/Ext.form.action.Submit.html @@ -0,0 +1,444 @@ +
Hierarchy
Ext.BaseExt.form.action.ActionExt.form.action.Submit
A class which handles submission of data from Forms +and processes the returned response.
+ + +Instances of this class are only created by a Form when +submitting.
+ + +Response Packet Criteria
+ + +A response packet may contain: +
success
property : Boolean
+success
property is required.errors
property : Object
+errors
property,
+which is optional, contains error messages for invalid fields.JSON Packets
+By default, response packets are assumed to be JSON, so a typical response +packet may look like this:
+{
+ success: false,
+ errors: {
+ clientCode: "Client not found",
+ portOfLoading: "This field must not be null"
+ }
+}
+Other data may be placed into the response for processing by the Ext.form.Basic's callback +or event handler methods. The object decoded from this JSON is available in the +result property.
+Alternatively, if an errorReader is specified as an XmlReader:
+ errorReader: new Ext.data.reader.Xml({
+ record : 'field',
+ success: '@success'
+ }, [
+ 'id', 'msg'
+ ]
+ )
+
+then the results may be sent back in XML format:
+<?xml version="1.0" encoding="UTF-8"?>
+<message success="false">
+<errors>
+ <field>
+ <id>clientCode</id>
+ <msg><![CDATA[Code not found. <br /><i>This is a test validation message from the server </i>]]></msg>
+ </field>
+ <field>
+ <id>portOfLoading</id>
+ <msg><![CDATA[Port not found. <br /><i>This is a test validation message from the server </i>]]></msg>
+ </field>
+</errors>
+</message>
+
+Other elements may be placed into the response XML for processing by the Ext.form.Basic's callback +or event handler methods. The XML document is available in the errorReader's xmlData property.
+ +Determines whether a Form's fields are validated +in a final call to isValid prior to submission. +Pass false in the Form's submit options to prevent this. Defaults to true.
+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:
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.
+ +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.
+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.
+ +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.
+The scope in which to call the configured success and failure +callback functions (the this reference for the callback functions).
+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.
+The function to call when a valid success return packet is received. +The function is passed the following parameters:
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.
+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.
+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.
+Failure type returned when client side validation of the Form fails +thus aborting a submit action. Client side validation is performed unless +clientValidation is explicitly set to false.
+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.
+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.
+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() { ... };
+});
+
+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 '$$$$$$$'
+Create a new instance of this Class. +Ext.define('My.cool.Class', {
+ +...
+
+
+});
+ +My.cool.Class.create({
+ +someConfig: true
+
+
+});
+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()
+
+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();
+ }
+}]
+
+
+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();
+
+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"
+
+The raw XMLHttpRequest object used to perform the action.
+The raw XMLHttpRequest object used to perform the action.
+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.
+Invokes this action using the current configuration.
+Invokes this action using the current configuration.
+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"
+
+The arguments, either an array or the arguments
object
Returns the result after calling the overridden method
+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'
+
+className
+