반응형

참조 : http://love2u.be/40

JqueryValidation.zip

+ jquery-1.4.2.min.js

+ jquery.validate.js

+ validation.js (예제)

Validation EX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$(document).ready(function() {
    $("#joinForm").validate({
        rules: {
            name:{required: true, minlength: 2, maxlength: 4, kor_eng: true},
            age :{required: true, minlength: 1, maxlength: 2, number: true},
            job :{required: true, minlength: 3, maxlength: 20},
            address :{required: true, minlength: 3, maxlength: 20},                    
        },
        messages: {
            name: {required: "이름을 입력하세요",minlength: jQuery.format("{0}자리 이상"),maxlength: jQuery.format("{0}자리 이하"), kor_eng: "한글과 영문만 가능"},
            age : {required: "나이를 입력하세요",minlength: jQuery.format("{0}자리 이상"),maxlength: jQuery.format("{0}자리 이하"), number: "숫자만 가능"},
            job : {required: "직업을 입력하세요",minlength: jQuery.format("{0}자리 이상"),maxlength: jQuery.format("{0}자리 이하")},
            address: {required: "주소를 입력하세요",minlength: jQuery.format("{0}자리 이상"),maxlength: jQuery.format("{0}자리 이하")},
        },
        success: function(label) {
            label.html(" ").addClass("checked");
        }
    });
});
cs


반응형

'IT > 언어' 카테고리의 다른 글

정규 표현식 예제  (0) 2014.05.21
Servlet 에러 페이지 처리  (0) 2014.05.21
tomcat7 SSL 설정  (0) 2014.05.19
[LIB] STRUT2  (0) 2014.05.19
[LIB] JSON  (0) 2014.05.19

+ Recent posts