Try this in your model... class Whatever extends AppModel { function beforeSave() { $data = &$this->data[$this->alias]; if (!empty($data['title'])) { $data['title'] = ucwords($data['title']); } return parent::beforeSave(); } }
Your could then make this a behavior down the track if you want to re- use this functionality. Cheers, Adam On Jan 10, 10:20 am, ingenious paradox <rjhenke...@yahoo.com> wrote: > I'm very new to cake and I was hoping someone could demonstrate the > code necessary to take a form field input value and convert it to > uppercase. I know this is simple with the ucwords() function, but for > some reason I just can't get it to work properly. > I read that you have to perform your own methods before cakes > execution of built in functions so I tried the beforeFilter() and no > luck. > > Some where in referencing the correct variable, converting it, and > then passing it back to the array that cake creates I'm screwing > things up. I simply want to take a word and capitalize it before it > gets stored in my database. > > this->($confused); --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---