hi all

I've just began in CakePHP and I'm a bit lost in validation datas
process

I was doing like this :

// model
$validate = array(...);

// controller
if (!empty($this->data)) {
  if ($this->ModelName->validates($this->data)) {
    ...
    if ($this->User->save($this->data)) { ... }
    ...
  }
}

Then I tried to use beforeValidate() function :

// model
function beforeValidate() {
  // use of sanitize, some data checks... using $this->data
}

And I had the problem that if a form was submited with an empty field,
$this->data was empty
problem reported here :
http://groups.google.com/group/cake-php/browse_thread/thread/f49c27ee02de64e1/1901293fc41a6ce3?lnk=gst&q=beforeValidate&rnum=11#1901293fc41a6ce3
http://groups.google.com/group/cake-php/browse_thread/thread/dacf48fb7735a28f/fbcdc9fa3f69500d?lnk=gst&q=beforeValidate&rnum=1#fbcdc9fa3f69500d
https://trac.cakephp.org/ticket/1040

In the last link :

We will no longer support calling Model::validates or
Model::invalidFields with parameters. You should set( ) the data, then
call validates( ) or invalidFields( ).

but in the API :
Model::validates($data = array())



I'm completely lost on what to do a correct validation process, if
someone could help me please.... thanx a lot


--~--~---------~--~----~------------~-------~--~----~
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