Hi I have 2 jquery date pickers on a form fromdate and todate.
I have to have following functionalities in the pickers
todate is available/enabled only when fromdate is selected -js call on onselect() of fromdate?
todate has dates available max of 30 days from the from date, later than 30 and previous dates are disabled. – i.e. setting maxdate parameter for todate?
I need to know how can this be achieved.
Thanks
Priyank
Hi I got somethings working but disabling of calendar is not happening. here are my current from and todate calendar selects. Write now I am just trying to disabled second calendar by default, I have yet to cmplete the onselect function to enable it, but its not getting disabled. Any other way to do this?
disabled = true is not working for datetimepicker.
Thanks
Priyank
<span class="labels">To Date</span>
<input type="text" name="dateFrom" value="" id="datefrom">
<script>
jQuery(function() {
jQuery( "#datefrom" ).datetimepicker({ dateFormat: 'yy-mm-dd',
showSecond: true,
timeFormat: 'hh:mm:ss',
changeMonth: true,
changeYear: true,
maxDate: new Date,
minDate: new Date('2011-08-02'),
showOn: "button",
buttonImage: "/calendar.png",
buttonImageOnly: true });
onSelect: function enabletoDate(dateText, inst) { }
});
</script>
<span class="labels">To Date</span>
<input type="text" name="dateto" value="" id="dateto">
<script>
jQuery(function() {
jQuery( "#dateto" ).datetimepicker({
disabled: true,
dateFormat: 'yy-mm-dd',
showSecond: true,
timeFormat: 'hh:mm:ss',
changeMonth: true,
changeYear: true,
showOn: "button",
buttonImage: "/images/users/calendar.png",
buttonImageOnly: true });
});
</script>
If you are using Jquery UI’s datepicker you can set the maxDate and minDate properties for the picker.
http://jqueryui.com/demos/datepicker/