Angular JS 밸리데이션
<%@ page language=”java” contentType=”text/html; charset=EUC-KR”
pageEncoding=”EUC-KR”%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js“>
</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=EUC-KR”>
<title>Insert title here</title>
</head>
<body>
<form method=”post” action=”j_spring_security_check”>
login
ID:<input type=”text” name=”j_username” size=”15″ ng-model=”j_username” ng-required=”true”>
PWD:<input type=”password” name=”j_password” size=”15″ ng-model=”j_password” ng-required=”true”>
<input type=”submit” value=”로그인”>
</form>
</body>
</html>
전화번호만 구분해내는 밸리데이션
<%@ page language=”java” contentType=”text/html; charset=EUC-KR”
pageEncoding=”EUC-KR”%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js“>
</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=EUC-KR”>
<title>Insert title here</title>
</head>
<body ng-app>
<form name=”myForm” method=”post” action=”j_spring_security_check”>
<input type=”text” name=”t2″
placeholder=”패스워드” ng-model=”user.password” ng-required=”true”
ng-pattern=”/^\d{3}-\d{3,4}-\d{4}$/”/>
<div ng-show=”myForm.t2.$error.pattern”>전화번호 형식으로 써주십시오</div>
<input type=”submit” value=”로그인” ng-click=”submit()”
ng-disabled=”myForm.t2.$dirty && myForm.t2.$invalid”>
</form>
</body>
</html>