-
Notifications
You must be signed in to change notification settings - Fork 1
/
register.js
57 lines (45 loc) · 1.24 KB
/
register.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$().ready(function() {
alert(1);
$("#signupform").validate({
rules:{
name:
{
required:true,
minlength:2
},
password:{
required: true,
minlength: 8,
},
cpassword:{
required: true,
minlength: 8,
equalTo: "#psw",
},
email:{
required: true,
email: true
},
messages:{
name: {
required:"Please enter your name",
minlength: "Your name must contain atleast 2 characters"},
password:
{
required:"Please provide a password",
minlength:"Password must be atleast 5 characters long"},
cpassword:
{required:"Please provide a password",
minlength:"Password must be atleast 5 characters long",
equalTo:"Password dont match"},
}
jQuery.validator.addMethod("name", function(value, element) {
return this.optional( element ) || /^[a-zA-Z]+$/.test( value );
}, 'Please enter a Name.');
jQuery.validator.addMethod("password", function( value, element, param ) {
var result = this.optional(element) || value.length >= 6 && /\d/.test(value) && /\w/.test(value);
return result;
}, "Your password must be at least 6 characters long and contain at least one number and one character.");
}
});
});