Ext.onReady(function(){
simple = new Ext.form.FormPanel({
renderTo:"loginForm",
labelWidth: 75, // label settings here cascade unless overridden
method:'POST',
frame:true,
title: '登录窗口',
bodyStyle:'padding:5px 5px 0',
width: 300,
defaults: {width: 200},
defaultType: 'textfield',
//实现非AJAX提交表单一定要加下面的两行!
onSubmit: Ext.emptyFn,
submit: function() {
this.getEl().dom.action='login.do'; //连接到服务器的url地址
this.getEl().dom.submit();
},
items: [{
fieldLabel: '用户名',
id: 'username',
name: 'name',
allowBlank:false,
width:150
},{
fieldLabel: '密码',
id: 'password',
name: 'pwd',
allowBlank:false,
width:150,
inputType:'password'
}
],
buttons: [{
text: '登录',
type:'button',
id:'login',
handler: login //添加事件,执行函数为login()
},{
text: '重置',
type:'reset',
id:'clear',
handler: reset //添加事件,执行函数为reset()
}
]
});
});
function login(){
simple.form.submit();
}
function reset(){
simple.form.reset();
}