class Post extends CActiveRecord{
public function rules(){
return array(
array('title, content', 'required',
'message'=>'Please enter a value for {attribute}.'),
// ... other rules
);
}
}
In the above, the customized error message contains a predefined placeholder {attribute}. The CRequiredValidator (whose alias is required) will replace this placeholder with the actual attribute name that fails the validation.
Reference:
http://www.yiiframework.com/wiki/1/
