1. 程式人生 > >ExtJs錯誤資訊提示的四種方式

ExtJs錯誤資訊提示的四種方式

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./../ext-3.3.1/resources/css/ext-all.css" />
<script type="text/javascript" src="./../ext-3.3.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="./../ext-3.3.1/ext-all-debug.js"></script>
<title>Insert title here</title>
<script type="text/javascript">
	Ext.onReady(function(){
		Ext.QuickTips.init();
		//Ext.form.field.prototype.msgTarget = "side";  統一錯誤提示方式
		 var simple = new Ext.FormPanel({
			labelWidth: 50,
			frame: true,
			title: 'Simple Form',
			width: 350,
			defaults: {width: 230},
			defaultType: 'textfield',
			items:[{
				msgTarget: 'qtip',
				fieldLabel: 'qtip',
				width: 100,
				allowBlank: false,
				blankText: '不能為空'
			},{
				msgTarget: 'title',
				fieldLabel: 'title',
				allowBlank: false,
				blankText: '不能為空'
			},{
				msgTarget: 'under',
				fieldLabel: 'under',
				allowBlank: false,
				blankText: '不能為空'
			},{
				msgTarget: 'side',
				fieldLabel: 'side',
				allowBlank: false,
				blankText: '不能為空'
			}] 
		});
		simple.render("form");	
	});
</script>
</head>
<body>
	<div id="form"></div>
</body>
</html>