You can validate from the controller using $this->Model->validate();

On Nov 30, 9:27 am, Milmar <[EMAIL PROTECTED]> wrote:
> I was able to solve this by first using $this->User->save($this->data)
> so that I can validate the fields in the model.
> Then switching to the "saveField" function in the Model's "beforeSave
> ()" callback so that the save would not affect the HABTM relations.
> Here's the code for "beforeSave()":
>
> function beforeSave() {
>          //If operation is save and this is an edit(has ID,password,
> and password_confirm),
>          //   use the saveField command to save the password
>          if(isset($this->data[$this->alias]['password']) && isset
> ($this->data[$this->alias]['id']) &&
>             isset($this->data[$this->alias]['password_confirm']))
>          {
>             return 
> $this->saveField('password',$this->data[$this->alias]['password']);
>
>          }
>
>          $this->hashPasswords(null, true);
>          return true;
>
> }
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to