日期:2014-05-16 浏览次数:20372 次
Ext.override(Ext.form.Action.Submit,{ run:function(){ 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 = []; fields.each(function(f) { if (f.el.getValue() == f.emptyText) { emptyFields.push(f); f.el.dom.value = ""; } }); } if(o.jsonData){ Ext.Ajax.request(Ext.apply(this.createCallback(o), { url:this.getUrl(isGet), method: method, headers: o.headers, jsonData:o.jsonData })); }else if(o.xmlData){ Ext.Ajax.request(Ext.apply(this.createCallback(o), { url:this.getUrl(isGet), method: method, headers: o.headers, xmlData:o.xmlData })); }else{ Ext.Ajax.request(Ext.apply(this.createCallback(o), { form:this.form.el.dom, url:this.getUrl(isGet), method: method, headers: o.headers, 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); } } return Ext.decode(response.responseText); } });