I have :
function beforeSave()
{
App::import('Core', 'sanitize');
$this->data = Sanitize::clean($this->data);
return true;
}
But no matter what I save nothing happens to the data.
Even tried adding this to the before save
function beforeSave()
{
App::import('Core', 'sanitize');
$this->data = Sanitize::clean($this->data);
if(!empty($this->data))
{
$this->data['Award']['title'] = 'added from beforeSave';
}
return true;
}
But still nothing.
Any ideas anyone?
On Nov 18, 2:40 am, Erik Nedwidek <[email protected]> wrote:
> Dave,
>
> No need to call the beforeSave method as it is a callback.
>
> function beforeSave() {
> App::import('Sanitize');
> $this->data = Sanitize::clean($this->data);
>
> return true;
>
> }
>
> That should be all you need to do. Throw a couple of $this->log() statements
> in there to verify the method is being called by Cake if you're not sure.
>
> Erik Nedwidek
> Project Manager
> Lighthouse I.T. Consulting, Inc.
>
> On Tue, Nov 17, 2009 at 10:37 PM, Dave <[email protected]> wrote:
> > Do you manually have to call beforeSave();
>
> > I have
> > function beforeSave()
> > {
> > $clean = new Sanitize();
> > $this->data = $clean->clean($this->data);
> > return true;
>
> > }
>
> > But it does nothing to the data.
>
> > What am I doing wrong?
>
> > Dave
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<cake-php%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=.
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
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=.