beforeSave() returned some error

Posted by kwokwai on Stack Overflow See other posts from Stack Overflow or by kwokwai
Published on 2010-06-12T14:27:45Z Indexed on 2010/06/12 14:32 UTC
Read the original article Hit count: 120

Filed under:

Hi all,

I got a simple input text field in a HTML form:

<input type="text" name="data[User][pswd]" id="data[User][pswd]">    

The scripts for the Controller's action that captured the data is as follows:

 function register(){ 
          $temp = $this->data;                       
          if(strlen($temp['User']['pswd'])>6) {           
            if ($this->User->save($this->data)) {
            $this->Session->setFlash('Data was Saved');         
                                                }
                                   }           
        } // this script works

And in the Model controller, I got these lines of codes:

  function beforeSave() {
     $raw = $this->data;
    if(strlen($raw['User']['pswd'])>6){
        md5($raw['User']['pswd']);        
    }
    return true;
                         } // this script failed to work

The data was stored into the Database successfully but it was not undergone any MD5 encryption.
I think that there must be some errors in the Model's script because I saw some errors
flashed after the data was saved, but the screen that showed the errors
immediately refreshed in a second after the data was saved successfully
and I couldn't see the detail of the errors that caused the problem.

Could you help me out please?

© Stack Overflow or respective owner

Related posts about cakephp