Friday, May 29, 2009

Re: Handling "minute" and "hour" elements in forms

Thanks,

the input fields work but cake still saves NULL values in the database
in this case. The problem seems to be that only "hour" and "minute"
get set but cake doesn't set any year, month or day informations in
the datetime field. The result is a null value in my datetime column
in mysql.

My view code:

<?php echo $form->datetime('OpeningStart','NONE','24');?>

When saving, the cake debug output says:

[OpeningStart] => Array
(
[hour] => 06
[min] => 0
)


--> mysql won't save the field. I have to set the date values for
"OpeningStart" by myself in the controller.

On 27 Mai, 17:02, Stu <greenmushroo...@gmail.com> wrote:
> ps: The view code should look something like this:
>
> echo $form->dateTime('column_name', 'NONE', '12');
>
> The '12' just represents the format, you can either choose '12' (e.g.
> 11:15 am)  or '24' (e.g. 23:15)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: