Hey all,

Honestly, once I get this all figured out, I plan to start providing more answers than questions in the forums, but until my drupal-fu is improved, I have one more thing with which I need help.

I'm trying to use the form api element type of 'date' to have a selectable year, month, and day. This displays just fine, and on hook_insert, enters the correct information into the database. Yeah! What I can't seem to figure out is how to get it to display the previously selected date (year, month, and day) when a user is editing / updating the node that contains this date form field. I guess I should mention that this is within a custom node module I am writing.

Anywho, with other selectable fields, there seems to be a #default_value field that I can simply reference $node->variable just fine. My checkboxes, single pull down lists, etc. all work as expected, but its a no go with the date type.

Part of my confusion is that the #options value doesn't seem to be available in the date type, as when I use this, it returns errors of 'illegal operation'. So in my mind the #default_value appears to be serving the purpose of #options in other selectable lists, but as such, I can't then figure out how to reload the previously selected date and time into the fields without eliminating the entire pull down menu.

What I have is as follows. Any help would be much appreciated. I have looked in the API, but that doesn't really explain much for me within forms or a search specific to format_date. But I'm a process oriented PHP guy, so a lot is greek to me anyway.

$options_content_date_produced = array(
'month' => format_date(time(), 'custom', 'n'),
'day' => format_date(time(), 'custom', 'j'),
'year' => format_date(time(), 'custom', 'Y')
);

$form['source']['content_date_produced'] = array(
'#title' => t('Production Date'),
'#type' => 'date',
'#description' => t('Select the production date.'),
'#default_value' => $options_content_date_produced,
'#weight' => -8
);