Hello, I've got a little problem here. I've got the following rule for one of my fields:
StartDate: {
required: isDelayed,
dateRU: true
}
isDelayed() returns false, so I guess StartDate field should be optional. However if I check it inside my dateRU method:
$.validator.addMethod(
"dateRU",
function(value, element) {
return this.optional(element) || isValidDate($.trim(value));
},
"Date is incorrect"
);
this.optional(element) always returns false for StartDate. I can't figure out what's wrong. Any ideas?
UPD. Does optional() returns true only if element is not required AND IS EMPTY? 'Cause that may be my problem.