日期:2014-05-16 浏览次数:20340 次
Ext.onReady(function(){ var formPanel = new Ext.FormPanel({ id : "formPanel", name : "formPanel", width : 800, renderTo : "formPanelDiv", onSubmit: Ext.emptyFn, submit: function(){ this.getEl().dom.action="formPanel.htm"; this.getEl().dom.submit(); }, items : [ new Ext.form.TextField({ id : "id", name : "id", allowBlank : false, blankText : "ID不能为空", fieldLabel : "ID", labelStyle : "text-align:right" }), new Ext.form.TextField({ id : "name", name : "name", allowBlank : false, blankText : "姓名不能为空", fieldLabel : "姓名", labelStyle : "text-align:right" }), new Ext.form.RadioGroup({ fieldLabel : "性别", labelStyle : "text-align:right", width : 80, items : [ new Ext.form.Radio({ name : "sex", boxLabel : "男", inputValue : "male", width : 20 }), new Ext.form.Radio({ name : "sex", boxLabel : "女", inputValue : "female", width : 20 }) ] }), new Ext.form.TextField({ id : "email", name : "email", fieldLabel : "邮箱", labelStyle : "text-align:right" }) ], buttons : [ { text : "登录", id : "btn_login", handler : function(){ if(formPanel.getForm().isValid()){ formPanel.getForm().submit(); } } }, { text : "重置", id : "btn_reset", handler : function(){ formPanel.getForm().reset(); } } ], buttonAlign : "center" }); });
Ext.onReady(function(){ Ext.QuickTips.init(); Ext.override(Ext.form.RadioGroup, { getValue: function(){ var v; if (this.rendered) { this.items.each(function(item){ if (!item.getValue()) return true; v = item.getRawValue(); return false; }); } else { for (var k in this.items) { if (this.items[k].checked) { v = this.items[k].inputValue; break; } } } return v; }, setValue: function(v){ if (this.rendered) this.items.each(function(item){ item.setValue(item.getRawValue() == v); }); else { for (var k in this.items) { this.items[k].checked = this.items[k].inputValue == v; } } } }); var radiogroup= new Ext.form.RadioGroup({ fieldLabel : "radioGroup", items : [{ boxLabel : '男', inputValue : "男", name : "rg", checked : true }, { boxLabel : '女', name : "rg", inputValue : "女" }] }); var _form=new Ext.form.FormPanel({ renderTo:'login-form', title:'系统登录', frame:true, width:290, height:160, layout:'form', buttonAlign:'center', labelAlign:'center', defaults:{width:160,labelWidth:80,xtype:'textfield'}, items:[ {fieldLabel:'用 户 名',vtype:'alpha',id:'name',name:'name'}, {fieldLabel:'通 行 证',inputType:'password',vtype:'alpha',id:'pass',name:'pass'}, radiogroup