日期:2014-05-16  浏览次数:20418 次

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>
?
1 楼 wangying641588 2011-06-03  
代码示例很详细、很清楚。谢谢哦!