-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.js
More file actions
48 lines (47 loc) · 770 Bytes
/
Copy pathvalidate.js
File metadata and controls
48 lines (47 loc) · 770 Bytes
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
var alphaNumeric = /^([A-Za-z0-9]+)$/;
var emailRegex = /^(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})$/;
var monthMMM = /^(JAN|FEB)$/
var ruleSet =
[
{
selector: "[name='summary']",
displayName: "Summary",
rules:
[
{
type: "knownGood",
test: alphaNumeric
},
{
type: "maxlength",
test: 10
},
{
type: "custom",
test: function() {
return $("#personalEmail").val() != 'admin@admin.com';
},
errorMsg: "I just don't like admin@admin.com"
}
]
},
{
selector: "#personalEmail",
displayName: "Personal Email",
rules:
[
{
type: "knownGood",
test: emailRegex,
errorMsg: "Personal email is in wrong format"
},
{
type: "minlength",
test: 6
},
{
type: "required"
}
]
}
]