a) by attaching the behavior in different ways (with different settings) 
for each action you can have the desired results
I think it was "allowEmpty" => false for add forms

b) you can't (and never should either) - due to the nature of how hashing 
works



Am Dienstag, 29. Mai 2012 20:57:49 UTC+2 schrieb lsri8088:
>
> Thanks euromak.
>
> I like the solution to check if it is empty but ... How do I distinguish 
> between "add action" and "edit action"?
> If I add a new user the password should be mandatory.
> If I edit the user then the password is blank if not modified.
>
> Another thing .... How can see the current value of the field in database? 
> For example
>
> function beforeSave(){
>      if(empty($this->data[$this->alias]['password']))
>             $this->data[$this->alias]['password'] = currentPassword;  // 
> hash password stored in data base
>      else
>             $this->data[$this->alias]['password'] = 
> AuthComponent::password($this->data[$this->alias]['password']);
>
> return true;
> }
>
> Thanks!
>
>
>>>  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to