dobelman
(Belkam)
November 10, 2012, 9:50am
1
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
powers
(Amohamed86)
November 10, 2012, 1:03pm
2
dobelman:
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'),
);
}
dobelman
(Belkam)
November 10, 2012, 1:44pm
3
it doesn’t works …
array('file', 'required', 'message'=>'message three'),
Its validate empty value, but my file is not uploaded
powers
(Amohamed86)
November 10, 2012, 2:00pm
4
dobelman:
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