<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';// 提示的方式,枚举值为"qtip","title","under","side",
function notNull(text){
if(this.allowBlank==false && Ext.util.Format.trim(text).length==0){
return false;
}else{
return true;
}
}
var form = new Ext.form.FormPanel({
defaultType: 'textfield',
labelAlign: 'right',
title: 'form',
labelWidth: 50,
frame:true,
width: 220,
monitorValid:true,
items: [{
fieldLabel: '文本框',
allowBlank:false,
blankText:"该项必须输入",
invalidText :"该项必须输入",
validator:notNull
}],
buttons: [{
text: '提交',
formBind:true,
handler: function() {
alert("即将提交");
});
}
}]
});
form.render("form");
});
</script>
</head>
<body>
<div id="form"></div>
</body>
</html>