日期:2014-05-16 浏览次数:20444 次
var forms=new Ext.form.FormPanel({ layout:"form", frame:true, items:[ { layout:"column", items:[ { columnWidth:.4, xtype:"fieldset", title:"a", layout: 'form', autoHeight: true, labelWidth:40, defaults: { allowBlank:true, xtype:'textfield', width:100 }, //defaults:{xtype:textfield}, items:[ {fieldLabel :"姓名",allowBlank:false,name:"username"}, {fieldLabel :"密码",inputType:"password",name:"password"} ] },{ columnWidth:.6, xtype:"fieldset", title:"b", layout: 'form', labelWidth: 40, autoHeight: true, //defaults:{xtype:textfield}, items:[ {fieldLabel :"性别",allowBlank:false,xtype:"textfield",name:"sex"}, {fieldLabel :"年龄",xtype:"textfield",name:"age"} ] } ] },{ xtype:"fieldset", autoHeight: true, title:"aaaaaaa", defaults:{ allowBlank:true, xtype:'textarea', width:100, labelWidth:50 }, items:[ {fieldLabel:"个人爱好",width:200,name:"xingqu"} ] } ] }); var windows=new Ext.Window({ title:"添加窗口", height:300, width:400, layout:"fit", items:[forms], buttonAlign:'center', buttons:[ { text:"ok", handler:function(){ forms.getForm().submit({ url : 'demo/demos!ext_test.action', waitMsg : '正在提交,请稍等……', timeout : 100000, method : 'GET', reset : true , //当提交后清空输入域的值 success : function(form,action){ //是与业务相关的只有后台响应为true或响应的JSON包含success:true Ext.Msg.alert("Success", action.result.msg); },failure : function(form,action){ //后台响应的JSON包含error:{},就认为连接失败 Ext.Msg.alert('提示','系统登入失败,原因<br/>' + action.failureType); } }); } },{ text:"cancle", handler:function(){ forms.form.reset(); } } ] }); windows.show();