Hi all,

I'm trying to use a 'date select' widget on a custom form, but not getting much output. Here is a snippet from my form creation function, which for testing is taken largely from the documentation sample:

  $date = time();
  $format = 'U';
  $form['start_date'] = array(
    '#type' => 'date_select', // types 'date_popup', 'date_text' and 'date_timezone' are also supported. See .inc file.
    '#title' => t('Date'),
    '#default_value' => $date, 
    '#date_format' => $format,
    '#date_label_position' => 'within', // See other available attributes and what they do in date_api_elements.inc
    '#date_timezone' => 'America/Chicago', // Optional, if your date has a timezone other than the site timezone.
    '#date_increment' => 15, // Optional, used by the date_select and date_popup elements to increment minutes and seconds.
    '#date_year_range' => '-3:+3', // Optional, used to set the year range (back 3 years and forward 3 years is the default).
    '#datepicker_options' => array(), // Optional, as of 7.x-2.6+, used to pass in additional parameters from the jQuery Datepicker widget.    
  );

This is largely abstract at this stage, but I'm just trying to get things working before I add real content etc.. The format of the default value and value I want returned is unix timestamp.

And the output this generates:

<div class="container-inline-date"><div class="form-item form-type-date-select form-item-start-date">
  <label for="edit-start-date">Date </label>
 <div class="date-padding clearfix" id="edit-start-date"></div>
</div>
</div>

Any help would be much appreciated.

Cheers,
Greg.

Comments

nickBumgarner’s picture

Did you ever find the solution here? I am having an issue now where we just updated the Date module and now our exposed date picker filter is broken. We are essentially getting the same markup as you.

All requirements are met and all the necessary files are loaded on the site.

alexlana’s picture

i have the same s*it. look for solution all night and not find. using D7.

casivaagustin’s picture

Are you calling the form with a drupal_get_form to be rendered ? if you don't call it into a drupal_get_form is not going to be rendered