public function Tmvalidate($attr) { //print_r($attr); foreach ($attr as $key => $value) { if ($key == 'company.name' && $value['value'] == '') { //echo 'bla'; Settings::addError('company.name', 'Field "company.name" is invalid...'); } if ($key == 'company.vat.id') { if ($value['value'] == '') { Settings::addError('company.vat.id', Yii::t('app', 'Not a valid VAT id')); } Settings::vatnumVal($key, $value['value']); } } echo \yii\helpers\Json::encode(Settings::getErrors()); //return parent::validate($attr); }