This question is locked. New answers and comments are not allowed.
Hi,
I've implemented een custom validator for MVC 2 to validate if property of type DateTime is a workday. In the client side validation script I use the datapickers client side API, Problem is that the value() method gives back the old selected value not the new one. It looks like te validation is triggered before the new date is available.
Is there a way to get the newly selected value?
Thanks,
Niels
ps. the client side script looks like:
I've implemented een custom validator for MVC 2 to validate if property of type DateTime is a workday. In the client side validation script I use the datapickers client side API, Problem is that the value() method gives back the old selected value not the new one. It looks like te validation is triggered before the new date is available.
Is there a way to get the newly selected value?
Thanks,
Niels
ps. the client side script looks like:
if
(jQuery.validator) {
jQuery.validator.addMethod(
"workday"
,
function
(value, element, params) {
var
chosenDate =
new
Date(value);
// check if element is datepicker
var
obj = $(element.parentElement.parentElement)
if
(obj.data() && obj.data(
'tDatePicker'
)) {
chosenDate = obj.data(
'tDatePicker'
).value();
obj.data(
'tDatePicker'
).hidePopup();
}
var
isWorkday = chosenDate.getDay() > 0 && chosenDate.getDay() < 6;
return
isWorkday;
});
}