-
Notifications
You must be signed in to change notification settings - Fork 1
/
validation.js
103 lines (101 loc) · 1.73 KB
/
validation.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function recaptchaCallback() {
var response = grecaptcha.getResponse();
jQuery("#grecaptcha").val(response);
console.log(jQuery("#sky-form").valid());
}
function recaptchaExpired() {
jQuery("#grecaptcha").val("");
}
$("#sky-form").validate({
// Rules for form validation
rules: {
name: {
required: true
},
email: {
required: true,
email: true
},
country: {
required: true
},
phone: {
required: true,
number: true,
maxlength: 10,
minlength: 8
},
message: {
required: true,
minlength: 10
},
hospital: {
required: true
},
grecaptcha: {
required: true,
minlength: 255
},
url: {
required: true,
url: true
},
date: {
required: true,
date: true
},
min: {
required: true,
minlength: 5
},
max: {
required: true,
maxlength: 5
},
range: {
required: true,
rangelength: [5, 10]
},
digits: {
required: true,
digits: true
},
number: {
required: true,
number: true
},
minVal: {
required: true,
min: 5
},
maxVal: {
required: true,
max: 100
},
rangeVal: {
required: true,
range: [5, 100]
}
},
// Messages for form validation
messages: {
name: {
required: "Please enter your name"
},
email: {
required: "Please enter your email address"
},
subject: {
required: "Please enter subject"
},
phone: {
required: "Please enter your Phone number"
},
message: {
required: "Please say something"
},
grecaptcha: {
required: "Please check the recaptcha"
}
}
});