Hi
I have some model with custom validation rule
public function rules()
{
return array(
...
array('role_id', 'exist', 'attributeName'=>'id', 'className'=>'UserRole', 'message'=>'Select {attribute}!'),
array('mail', 'someFunction'),
...
);
}
public function attributeLabels()
{
return array(
...
'mail' => 'E-mail',
'role' => 'User role',
...
);
}
public function someFunction($attribute,$params)
{
if(!$this->hasErrors())
{
.....
if(....)
{
$this->addError('mail','{attribute} ...!');
}
elseif()
{
$this->addError('mail','....{attribute} ...!');
}
}
}
When model can not be validated by role_id field rule, I get message ‘Select User role!’
But if model can not be validated by mail filed, I get messages like ‘{attribute} …!’
So I want to get {attribute} substituted by attribute label, but it is not substituted. Why?