Archive

Posts Tagged ‘cakePHP validates’

Using validates() in cakePHP 1.2

December 4th, 2008

Today I was dealing with a nasty problem. I was trying to validate form data without saving it, which was supposed to work like this:


if ($this->Location->validates($this->data)) {}

The only problem was… it didn’t work! It took me some time until I figured out that the Parameter usage of validated() is deprecated: Thanks to cakebaker for his blog entry!

So if you are trying to achieve the functionality from above you should use this code instead:


if ($this->Location->create($this->data) && $this->Location->validates()) {}

cakePHP