Validate date selection in date picker I am using a javascript datepicker to allow users to select a date (which I have functioning in my form). What I don't know how to do is limit the dates that can be selected. Is there a way to do this using the datepicker instead of validating the form on submission?

Here is the code I am using to create the date selector:

drupal_add_library('system', 'ui.datepicker');
drupal_add_js($path . '/providers/support/js/datepicker.js');
drupal_add_js(array('dateselector' =&gt; array('date_format' =&gt; $date_picker_format)), 'setting');
return array(
  '#type' =&gt; 'textfield',
  '#default_value' =&gt; $current_value,
  '#attributes' =&gt; array('class' =&gt; array('datefield')),
);


Am I missing an option somewhere?
I don't see, how you initialize the datepicker (probably in */providers/support/js/datepicker.js file), but for this functionality you should use maxDate and minDate options of datepicker library.