Custom form with Date textfield with jQuery popup I'm making a custom form and I would like to render a field that is just like the form that gets rendered for a Date with a jQuery Popup when editing a node. 



I can't figure out how to build the array so that it will get rendered by drupal properly. I've tried a ton of different attempts, but this is what I've got currently:

$form['birthdate'] = array(
    '#title' =&gt; t("Offspring Birth Date"),
    '#id' =&gt; 'edit-field-filter-birthdate',
    '#type' =&gt; 'date_popup',
    '#default_value' =&gt; '2015-01-01 10:30:00',
    '#date_type' =&gt; DATE_DATETIME,
    '#date_timezone' =&gt; date_default_timezone(),
    '#date_format' =&gt; 'm-d-Y H:i',
    '#date_increment' =&gt; 1,
    '#date_year_range' =&gt; '-3:+3',
);

$html = drupal_render($form);


The README.txt in the date/date_popup module says:


  To include a popup calendar in a form, use the type 'date_popup':
  
  $form['date'] = array(
      '#type' => 'date_popup':
      '#title => t('My Date'),
      ....   );
  
  Set the #type to date_popup and fill the element #default_value with a
  date adjusted to the proper local timezone, or leave it blank.


However, all that ever gets rendered is just the '#title'. 

What am I doing wrong?
You need to initialize the form with drupal_get_form():

$form = drupal_get_form('MYMODULE_birthdate_form');
$html = drupal_render($form);

function MYMODULE_birthdate_form($form, &amp;$form_state) {
  $form['birthdate'] = array(
    '#type' =&gt; 'date_popup',
    // ...
  );
  return $form
}