p.s if you dont update, change your code to this: function add() {
if (!empty($this->data)) { $this->Closeddate->create(); $this->cleanUpFields(); if ($this->Closeddate->save($this->data)) { $this->flash('The new details have been saved.','/closeddates'); } } } function edit($id = null) { $this->Closeddate->id = $id; if (empty($this->data)) { $this->data = $this->Closeddate->read(); } else { $this->cleanUpFields(); if ($this->Closeddate->save($this->data)) { $this->flash('Your Closed Date has been updated.','/ closeddates'); } } } On Apr 30, 1:54 pm, "annie.r.knight" <[EMAIL PROTECTED]> wrote: > Thanks for the reply. > > I print_r'ed the $this->data and I noted that it's split into a number > of array elements. That's fine. > > But why is it necessary to 'clean up' when referring to the data as > $this->data['Closeddate'] when it is not necessary with $this->data? > > On Apr 30, 2:22 pm, djiize <[EMAIL PROTECTED]> wrote: > > > try a pr($this->data) in your controller and you'll the date is not > > "DB compliant" (it is split in several parts) > > do a $this->cleanUpFields() before Model->save() > > > On 30 avr, 13:13, "annie.r.knight" <[EMAIL PROTECTED]> > > wrote: > > > > I'm very new to CakePHP so please do bear with me. > > > > I've used the simple blog application from the manual as a crib for a > > > small application that I'm creating. I ran into a problem when simply > > > trying to deal with some date inputs in forms. The dates would insert > > > ok, but if I tried to edit them I'd run into a brick wall: there was > > > no update query being executed at all. If I changed the field type to > > > text it was working ok. > > > > My controller's add() function looked like this: > > > > function add() { > > > > if (!empty($this->data)) { > > > if ($this->Closeddate->save($this->data)) { > > > $this->flash('The new details have been > > > saved.','/closeddates'); > > > } > > > } > > > > } > > > > And the edit() function: > > > > function edit($id = null) { > > > > $this->Closeddate->id = $id; > > > > if (empty($this->data)) { > > > $this->data = $this->Closeddate->read(); > > > } > > > else { > > > > if > > > ($this->Closeddate->save($this->data['Closeddate'])) { > > > $this->flash('Your Closed Date > > > has been updated.','/ > > > closeddates'); > > > } > > > } > > > } > > > > I fixed it by changing the parameter to the save() function to $this- > > > > >data (less the array index). > > > > So my question: Why does the broken method not work with dates? What > > > did I do wrong? What am I misunderstanding? > > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---