mjl927
02-13-2009, 03:14 PM
I need some help with my datepicker. I'm using the datepicker tool from this website:
http://keith-wood.name/datepick.html
I have two date fields setup with the datepicker and they work together to create a date range.
the code I'm using for this is right from the website and it work perfectly.
function customRange(input){
return{
minDate: (input.id == 'cmn_enddate' ? $('#cmn_stdate').datepick('getDate') : null),
maxDate: (input.id == 'cmn_stdate' ? $('#cmn_enddate').datepick('getDate') : null)
};
};
// Add DatePicker
$('#cmn_stdate').datepick({beforeShow: customRange});
$('#cmn_enddate').datepick({beforeShow: customRange});
cmn_stdate is the start date and cmn_enddate is the end date. If a user picks the start date first, then the end date range cannot be selected before the start date. Likewise, if a user picks the end date first, a start date that comes after the end date cannot be chosen. As I said, this is working great.
However, I want it so that only dates that start two days from today to be selectable. All dates prior to that should be unselectable. This seems to only work if I use the minDate attribute by itself. But then the start/end ranges function doesn't work.
Any ideas would be most appreciated.
Thanks.
http://keith-wood.name/datepick.html
I have two date fields setup with the datepicker and they work together to create a date range.
the code I'm using for this is right from the website and it work perfectly.
function customRange(input){
return{
minDate: (input.id == 'cmn_enddate' ? $('#cmn_stdate').datepick('getDate') : null),
maxDate: (input.id == 'cmn_stdate' ? $('#cmn_enddate').datepick('getDate') : null)
};
};
// Add DatePicker
$('#cmn_stdate').datepick({beforeShow: customRange});
$('#cmn_enddate').datepick({beforeShow: customRange});
cmn_stdate is the start date and cmn_enddate is the end date. If a user picks the start date first, then the end date range cannot be selected before the start date. Likewise, if a user picks the end date first, a start date that comes after the end date cannot be chosen. As I said, this is working great.
However, I want it so that only dates that start two days from today to be selectable. All dates prior to that should be unselectable. This seems to only work if I use the minDate attribute by itself. But then the start/end ranges function doesn't work.
Any ideas would be most appreciated.
Thanks.