Create a custom method for doing this, instead of doing it in
beforeValidate(). (You will have to change the $this->data a bit).

function checkCode() {
           App::import('Core','Sanitize');
           $clean = Sanitize::stripScripts($this->data['Comment']
['comment']);
           $clean = Sanitize::stripWhitespace($clean);
           $this->data['Comment']['comment']= $clean;
           if(strlen($clean)==0){
                return false;
           }
           else return true;
    }

var $validate = array(
                'comment' => array(
                                'rule' => array('checkCode'),
                                'required' => true,
                        'message' => 'Comment Field Cannot be
empty'));
--~--~---------~--~----~------------~-------~--~----~
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