I would like to use a radio button to control the datepicker so that it changes the days that can be selected.
i.e.
radio choice 1 - user can only select four days in advance.
radio choice 2 - user can only select two days in advance.
radio choice 3 - user can only select one day in advance.
This is the code I am currently using for four days in advance:
$(function(frm) {
var fourWorkingDays = new Date();
var adjustments = [0, 0, 2, 2, 2, 2, 1];
fourWorkingDays.setDate(fourWorkingDays.getDate() + 4 + adjustments[fourWorkingDays.getDay()]);
$('#popupDatepicker, #popupDatepicker1').datepick({
dateFormat:'dd/mm/yyyy',
onDate: $.datepick.noWeekends,
minDate:fourWorkingDays,
showTrigger:'<img src="calendar2.gif" alt="Popup" class="trigger">',
onSelect:customRange});
function customRange(dates) {
if (this.id == 'popupDatepicker') {
$('#popupDatepicker1').datepick('option', 'minDate',dates[0] || null);
}
else
{
$('#popupDatepicker').datepick('option', 'maxDate', dates[0] || null);
}
}
});
Thanks in advance for any suggestions.