X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..6b044c28b5f26fb99c86c237ffad19741c0f7f3d:/src/widgets/form/Action.js?ds=sidebyside
diff --git a/src/widgets/form/Action.js b/src/widgets/form/Action.js
index 4e6ac419..c09fb38e 100644
--- a/src/widgets/form/Action.js
+++ b/src/widgets/form/Action.js
@@ -1,8 +1,8 @@
/*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
/**
* @class Ext.form.Action
@@ -113,6 +113,11 @@ Ext.form.Action.prototype = {
* during the time the action is being processed.
*/
+/**
+ * @cfg {Boolean} submitEmptyText If set to true, the emptyText value will be sent with the form
+ * when it is submitted. Defaults to true.
+ */
+
/**
* The type of action this Action instance performs.
* Currently only "submit" and "load" are supported.
@@ -331,10 +336,25 @@ Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
// private
run : function(){
- var o = this.options;
- var method = this.getMethod();
- var isGet = method == 'GET';
+ var o = this.options,
+ method = this.getMethod(),
+ isGet = method == 'GET';
if(o.clientValidation === false || this.form.isValid()){
+ if (o.submitEmptyText === false) {
+ var fields = this.form.items,
+ emptyFields = [],
+ setupEmptyFields = function(f){
+ if (f.el.getValue() == f.emptyText) {
+ emptyFields.push(f);
+ f.el.dom.value = "";
+ }
+ if(f.isComposite && f.rendered){
+ f.items.each(setupEmptyFields);
+ }
+ };
+
+ fields.each(setupEmptyFields);
+ }
Ext.Ajax.request(Ext.apply(this.createCallback(o), {
form:this.form.el.dom,
url:this.getUrl(isGet),
@@ -343,6 +363,13 @@ Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
params:!isGet ? this.getParams() : null,
isUpload: this.form.fileUpload
}));
+ if (o.submitEmptyText === false) {
+ Ext.each(emptyFields, function(f) {
+ if (f.applyEmptyText) {
+ f.applyEmptyText();
+ }
+ });
+ }
}else if (o.clientValidation !== false){ // client validation failed
this.failureType = Ext.form.Action.CLIENT_INVALID;
this.form.afterAction(this, false);
@@ -602,7 +629,7 @@ Ext.form.Action.DirectLoad = Ext.extend(Ext.form.Action.Load, {
this.result = result;
return result;
},
-
+
success : function(response, trans){
if(trans.type == Ext.Direct.exceptions.SERVER){
response = {};
@@ -734,7 +761,7 @@ Ext.form.Action.DirectSubmit = Ext.extend(Ext.form.Action.Submit, {
this.result = result;
return result;
},
-
+
success : function(response, trans){
if(trans.type == Ext.Direct.exceptions.SERVER){
response = {};