EndErr
(Enderr)
1
I’m triying to create a unique validation rule for a field if it is not empty.
The code I’ve tried:
[['kod'], 'unique'],
or
['kod', 'unique', 'when' => function($model){
return $model->kod !== ''; //!empty($model->kod);
}, 'enableClientValidation' => false],
or
['kod', 'validateKod', 'when' => function($model){
return $model->kod !== ''; //!empty($model->kod);
}],
But in every case I get the error:
Response content must not be an array.
The field’s ‘kod’ value is just a string not array.
patrickm
(Yiiframework)
2
Where do you get that error?
EndErr
(Enderr)
3
If you mean in what action then it is in update.
patrickm
(Yiiframework)
4
No I mean where does that error show up? JS? PHP?
EndErr
(Enderr)
5
PHP, no js actions, just a standard action on update a record.
The error comes up on saving the record.
patrickm
(Yiiframework)
6
Please post the code that actually causes the error and specify in which line it occurs.