(21)ExtJS之使用VType验证

JS文件:

//6:表单中使用VType验证示例
Ext.onReady(function(){
	Ext.QuickTips.init();
	Ext.create('Ext.form.Panel',{
		title:'vtype示例',
		width:300,
		frame:true,
		renderTo:Ext.getBody(),
		bodyPadding:5,
		defaultType:'textfield',
		fieldDefaults:{
			labelSeparator:':',
			labelWidth:80,
			width:270,
			msgTarget:'side'
		},
		items:[{
			fieldLabel:'电子邮件',
			vtype:'email'
		},{
			fieldLabel:'网址',
			vtype:'url'
		},{
			fieldLabel:'字母',
			vtype:'alpha'
		},{
			fieldLabel:'字母和数字',
			vtype:'alphanum'
		}]
	});
	
});


JSP文件:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'JS1.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!-- extjs的样式文件 -->
	<link rel="stylesheet" type="text/css" href="js/extjs/resources/css/ext-all.css">
	<!-- extjs的核心文件 -->
	<script type="text/javascript" charset="utf-8" src="js/extjs/ext-all-debug.js"></script>
	<!-- 国际化文件 -->
	<script type="text/javascript" charset="utf-8" src="js/extjs/ext-lang-zh_CN.js"></script>
	
	<script type="text/javascript" charset="utf-8" src="base/011_form_dateandother.js"></script>

  </head>
  <body></body>
</html>




你可能感兴趣的:((21)ExtJS之使用VType验证)