Where is the best place for documentation? I am trying to add multiple rules to my validator but I have something that is causing it to default to the first rule. Can you help with this?
01.
<script>
02.
var
myValidator = $(
'#keying_form'
).kendoValidator({
03.
rules: {
04.
custom:
function
(element) {
05.
var
attr = $(element).attr(
'checkDates'
);
06.
if
(
typeof
attr !==
typeof
undefined && attr !==
false
) {
07.
console.log(
'validating a date--> '
);
08.
console.log(element);
09.
10.
var
value = $(element).val();
11.
12.
if
(value ==
null
|| value.length === 0) {
13.
console.log(
'date is empty.'
);
14.
return
true
;
15.
}
16.
17.
var
date = kendo.parseDate(value);
18.
if
(!date) {
19.
console.log(
'date is invalid!'
);
20.
return
false
;
21.
}
22.
23.
console.log(
'date is valid.'
);
24.
25.
}
26.
27.
return
true
;
28.
},
29.
custom2:
function
(element) {
30.
var
attr = $(element).attr(
'checkTime'
);
31.
if
(
typeof
attr !==
typeof
undefined && attr !==
false
) {
32.
console.log(
'validating a time--> '
);
33.
console.log(element);
34.
35.
var
value = $(element).val();
36.
37.
if
(value ==
null
|| value.length === 0) {
38.
console.log(
'time is empty.'
);
39.
return
true
;
40.
}
41.
42.
var
date = kendo.parseDate(value);
43.
if
(!date) {
44.
console.log(
'time is invalid!'
);
45.
return
false
;
46.
}
47.
48.
console.log(
'time is valid.'
);
49.
50.
}
51.
52.
return
true
;
53.
},
54.
55.
},
56.
messages: {
57.
custom:
function
(element) {
58.
return
$(element).val() +
' is not a valid date.'
;
59.
},
60.
custom2:
function
(element) {
61.
return
$(element).val() +
' is not a valid time.'
;
62.
}
63.
64.
},
65.
});
66.
67.
</script>