为什么我自定义的FormPanel提交后,后台接收不到表单数据?
cobert
2013-03-29
/*FormPanel*/ FormPanel_TradeInfoWeek = Ext.extend(Ext.form.FormPanel,{ /*构造函数*/ constructor:function(){ FormPanel_TradeInfoWeek.superclass.constructor.call(this,{ //renderTo:Ext.getBody(), labelWidth:80, height:300, width:300, baseCls:"x-plain", defaultType:"textfield", defaults:{anchor:"100%"}, style:"padding:5px", items:[{ xtype:"combo", fieldLabel:"区 域", mode:"local", displayField:"region", triggerAction:"all", emptyText:"请选择地区", editable:false, name:'tiw.region', store:new Ext.data.SimpleStore({ fields:["region"], data:[["1区"],["2区"],["3区"],["4区"]] }) },{ xtype:"combo", fieldLabel:"房屋类型", mode:"local", displayField:"h_value", triggerAction:"all", emptyText:"请选择房屋类型", editable:false, name:'tiw.type', store:new Ext.data.SimpleStore({ fields:['h_type','h_value'], data:[[1,"商品房"],[2,"二手房"]] }) },{ xtype:"numberfield", fieldLabel:"住宅套数", name:'tiw.zzCount' },{ xtype:"numberfield", fieldLabel:"非住宅套数", name:'tiw.fzzCount' },{ xtype:"numberfield", fieldLabel:"住宅交易额", name:'tiw.zzValue' },{ xtype:"numberfield", fieldLabel:"非住宅交易额", name:'tiw.fzzValue' },{ xtype:"numberfield", fieldLabel:"住宅面积", name:'tiw.zzArea' },{ xtype:"numberfield", fieldLabel:"非住宅面积", name:'tiw.fzzArea' },{ xtype:"numberfield", fieldLabel:"住宅均价", name:'tiw.zzAvgPrice' },{ xtype:"numberfield", fieldLabel:"非住宅均价", name:'tiw.fzzAvgPrice' },{ xtype:"datefield", fieldLabel:"统计日期", format:"Y-m-d", value:new Date(), name:'tiw.date'//value:"1984-11-20" readOnly:true, } ] }); this.addEvents("submit"); }, /*提交*/ submit:function(){ try{ this.getForm().submit({url:'addTiw.action',success:function(form,action){alert("提交成功");},waitTitle:"数据提交",waitMsg:"数据传送中,请稍候...",scope:this}); }catch(e){ } }, /*初始化*/ reset:function(){ this.getForm.reset(); } }); |
|
cobert
2013-04-01
问题解决了,在submit方法中写了reset方法,这样导致在没有完全体较之前表单中的数据就被初始化了,所以没接收到表单数据。
解决方法: 在submit方法的 success方法中写reset方法就行了。 |