Hi everyone.

I want to add the value of an sfWidgetFormI18nTime to an
sfWidgetFormJqueryDate and store it into a column in my database but
it doesn't work.

here is my form.


    $dateWidget = new sfWidgetFormI18nDate(array(
                            'format' => '%day%/%month%/%year%',
                            'month_format' => 'short_name',
                            'culture' => 'fr'));

    $this->widgetSchema['begin_date'] = new
sfWidgetFormJqueryDate(array(
                            'image' => '/images/icons/calendar.png',
                            'culture' => 'fr',
                            'date_widget' => $dateWidget));

    $this->widgetSchema['end_date'] = new
sfWidgetFormJqueryDate(array(
                            'image' => '/images/icons/calendar.png',
                            'culture' => 'fr',
                            'date_widget' => $dateWidget));

    $this->widgetSchema['begin_hour'] = new
sfWidgetFormI18nTime(array(
                            'culture' => 'fr'));

    $this->widgetSchema['end_hour'] = new sfWidgetFormI18nTime(array(
                            'culture' => 'fr'));

    $this->validatorSchema['end_hour'] = new
sfValidatorDateTime(array('required' => false));
    $this->validatorSchema['begin_hour'] = new
sfValidatorDateTime(array('required' => false));

my action :

    ...

    $ev = $request->getPostParameter('event');
    $form->getObject()-
>setBeginDate(self::_getTimeStamp($ev['begin_date'],
$ev['begin_hour']));
    $form->getObject()->setEndDate(self::_getTimeStamp($ev['end_date'],
$ev['end_hour']));

    ...

    private function _getTimeStamp($date , $time) {
            return mktime($time['hour'],$time['minute'],
0,$date['month'],$date['day'],$date['year']);
        }

When i do this i put a timestamp in my object attributes : Example :
1282154400 for 18/08/2010 18:00

but when i do

    event = $form->save();

he doesn't take care of the time and i have only 18/08/2010 12:32

Can you help me please.

PS : don't tell me to use the datetime because it's not user friendly
at all. here i need the 2 separate widget for my future JS
PS2 : Thank you for reading.
PS3 : Here is the initial post : 
http://forum.symfony-project.org/viewtopic.php?f=22&t=29388

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to