Sometimes you only want to allow the user to pick dates after a certain date - e.g. only in the future; or only after a week from today; or you only want to allow them to pick dates before a certain - e.g. only in the past; or more than ten years ago. This FAQ shows one way of doing that with the MooTools datepicker.
The new version of this tutorial for ChronoForms 8 is available here
The code in this FAQ is written for the MooTools datepicker. Click the form name link in the Forms Manager and scroll down the General tab to find the Date Picker Settings and set the DatePicker Type to "MooTools DatePicker".
Setting a start date
minDate: start_date
Adding JavaScript: If you are using the Easy Form Wizard go to the Others | JS/CSS Settings tab and use the JavaScript Code box; if you are using the Normal/Advanced Wizard drag a Load JS action from the Utilities group into the On Load event and drag it up before the Show HTML action.
var start_date = new Date();
var start_date = new Date().increment('day', 7);
Setting an end date
maxDate: end_date
var end_date = new Date();
var start_date = new Date().decrement('year', 10);
Note this uses decrement not increment!
Setting a start and end date
minDate: start_date, maxDate: end_date
var start_date = new Date().increment('week', 1); var end_date = new Date().increment('week', 5);
Valid time intervals are 'day', 'week', 'month', 'year' or 'hour', 'minute', 'second', and 'ms' if you use a time picker
Setting fixed dates
var start_date = new Date ('2013-06-21'); var end_date = new Date('2013-12-24');
See the MooTools documents here for more options for handling dates.
Comments: