DarkSlash
(Darkslash)
1
Right now I change the message that the form displays on an error in this way:
public function rules()
{
return [
[['myField1', 'myField2'], 'required', 'message' => 'This is my custom message'],
[['myField1_id', 'myField2'], 'integer']
];
}
The bad thing if that I have to do for EVERY model that I have. There’s a way to redefine the default error messages?
hrnair
(Harikrishnan Hr)
2
You can save and retrieve from \config\params.php
for eg:
public function rules()
{
return [
[['myField1', 'myField2'], 'required', 'message' => Yii::$app->params['reqMsg']],
[['myField1_id', 'myField2'], 'integer']
];
}
phtamas
(Phtamas)
4