Ext.onReady(function() {
// 开启表单提示
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'qtip'; // 设置提示信息位置为提示型,出现位置以鼠标为准
Ext.form.Field.prototype.msgTarget = 'side'; // 设置提示信息位置在边上
Ext.form.Field.prototype.msgTarget = 'title'; //html中简单的title效果
var f = new Ext.form.FormPanel({
renderTo : document.body,
title : "用户信息录入框",
url : "person.ejf",
height : 200,
width : 300,
labelWidth : 60,
labelAlign : "right",
frame : true,
defaults : {
xtype : "textfield", // 可简写成defaultType:'textfield'
width : 180
},
items : [{
name : "username",
fieldLabel : "姓名",
allowBlank : false, // 禁止为空
blankText : '姓名不能为空'// 姓名时的提示信息
}, {
name : "password",
fieldLabel : "密码",
inputType : "password"
}, {
name : "email",
fieldLabel : "电子邮件"
}, {
xtype : "textarea",
name : "intro",
fieldLabel : "简介"
}],
buttons : [{
text : "提交",
handler : function() {
f.form.submit({
waitTitle : '请稍候',
waitMsg : '正在提交表单数据, 请稍候。。。。。。',
url : '',
success : function(form,
action) {
// ...
},
failure : function(form,
action) {
// f.form.reset();
}
});
}
}, {
text : "重置",
handler : function() {
f.form.reset();
}
}]
})
});