--- jscalendar.module.cvs 2006-09-17 19:32:02.000000000 +0200 +++ jscalendar.module 2006-10-02 00:07:18.000000000 +0200 @@ -36,14 +36,19 @@ foreach (element_children($form) as $key) { if (isset($form[$key]) && isset($form[$key]['#attributes']) && isset($form[$key]['#attributes']['class']) && !(strpos($form[$key]['#attributes']['class'], 'jscalendar') === FALSE)) { jscalendar_load(); - $settings = array('ifFormat', 'showsTime', 'timeFormat'); + $settings = array('timestamp', 'ifFormat', 'showsTime', 'timeFormat'); foreach ($settings as $setting) { - if (isset($form[$key]['#jscalendar_' . $setting])) { + if (isset($form[$key]['#jscalendar_'.$setting])) { + $form[$key.'_jscalendar']['#tree'] = true; $form[$key.'_jscalendar'][$setting] = array( '#type' => 'hidden', - '#value' => $form[$key]['#jscalendar_' . $setting] + '#value' => $form[$key]['#jscalendar_'.$setting], ); - unset($form[$key]['#jscalendar_' . $setting]); + if ($setting != 'timestamp') { + // disable values not necessary in form submit + $form[$key.'_jscalendar'][$setting]['#attributes']['disabled'] = TRUE; + } + unset($form[$key]['#jscalendar_'.$setting]); } } } --- jscalendar.js.cvs 2006-09-17 19:32:02.000000000 +0200 +++ jscalendar.js 2006-10-02 00:11:42.000000000 +0200 @@ -24,10 +24,18 @@ ifFormat : settings['ifFormat'], button : input.getAttribute('id') + '-button', showsTime : settings['showsTime'], - timeFormat : settings['timeFormat'] + timeFormat : settings['timeFormat'], + timestamp : $(input.id+'_jscalendar-timestamp'), + onUpdate : calendarUpdated } ); } } }); } + +function calendarUpdated(cal) { + // update timestamp hidden value + var timestamp = cal.params.timestamp; + if (timestamp) timestamp.value = cal.date.print('%s'); +}