Cfilevalidator Empty Changing Message

Hello,

i use CFileValidator. I want to change this message: “File cannot be blank”, but i have no idea how to do this. In specifitation class there is ‘tooLarge’ and so on…, but no empty… Can U help me?


 public function rules() {

      return array(

          array('file', 'file', 'types' => 'jpg', 'maxSize'=>0.3*1024*1024, 'allowEmpty'=>false, 'maxFiles'=>1,

              'tooLarge'=>'message one',

              'wrongType'=>'message two'),

      );

   }

thx

I think you might want too make another rule with the required word so


 public function rules() {

      return array(

          array('file', 'file', 'types' => 'jpg', 'maxSize'=>0.3*1024*1024, 'allowEmpty'=>false, 'maxFiles'=>1,

              'tooLarge'=>'message one',

              'wrongType'=>'message two'),

 array('file', 'required', 'message'=>'message three'),

      );

   }

it doesn’t works …


 array('file', 'required', 'message'=>'message three'),

Its validate empty value, but my file is not uploaded :(

actually sorry, after checking my one it’s more like


array('file', 'file', 'types' => 'jpg', 'maxSize'=>0.3*1024*1024, 'allowEmpty'=>false, 'maxFiles'=>1,

              'tooLarge'=>'message one',

              'wrongType'=>'message two',

'message'=>'message three' 

),

      );

Your 1st way was correct :)

Yeah, it works …

as simple textField :P

thanks for reply!