I can’t disable the input, but I need to validate it no matter what the datepicker does.
$("#datepicker").datepicker({minDate: 0, maxDate: +7});
This produces the calendar I want, but won’t validate the input field.
I have the validator plugin already in use requiring fields so I’d like to stick to that.
This code will check if the field is required, but it won’t check the max date:
$(document).ready(function() {
$("#form").validate({
rules: {
datepicker: {
required: true,
date: true,
maxDate: 7
}
}
});
});
See my jsfiddle, your js code should work.
Enter
10/22/2011into the input field and presssubmit. The max date will be checked.You can remove the
maxDaterow in yourrules, it will be ignored.