In controller before save() method:     $this->cleanUpFields('Contest');

http://api.cakephp.org/1.2/class_controller.html#f6d9f131aca280eb1c21e3665b0de659



On Sep 6, 12:41 pm, Copot <[EMAIL PROTECTED]> wrote:
> I have a model called Contest with two datetime fields (starts_at,
> ends_at)
> In the view, I have
>
> <?php echo $form->create('Contest', array('enctype' => 'multipart/form-
> data'));?>
>
>         <?php echo $form->input('Contest.id', array('type' => 'hidden'));?>
>
>         <?php echo $form->dateTime('Contest.starts_at');?>
>         <?php echo $form->dateTime('Contest.ends_at');?>
>
>        also tried using
>
>         <?php echo $form->input('Contest.starts_at');?>
>         <?php echo $form->input('Contest.ends_at');?>
>
>       </form>
>
> but the datetime fields aren't updated with values matching those
> selected.
>
> I'm using the latest version - 1.2.0.5427alpha.
>
> I put this in the model to get the values being saved
>
>         function afterSave() {
>                 echo "<pre>";
>                 print_r($this->data);
>                 exit;
>         }
>
> and I get something like this:
>
> Array
> (
>     [Contest] => Array
>         (
>             [id] => 2
>             [name] => Contest
>             [starts_at_day] => 11
>             [starts_at_month] => 07
>             [starts_at_year] => 1987
>             [starts_at_hour] => 01
>             [starts_at_min] => 32
>             [starts_at_meridian] => am
>             [ends_at_day] => 12
>             [ends_at_month] => 12
>             [ends_at_year] => 2022
>             [ends_at_hour] => 02
>             [ends_at_min] => 41
>             [ends_at_meridian] => am
>             [active] => 1
>         )
>
> insteat of
>
> Array
> (
>     [Contest] => Array
>         (
>             [id] => 2
>             [name] => Contest
>             [starts_at] => value
>             [ends_at] => value
>             [active] => 1
>         )
>
> Anyone can help ?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to