{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/10987","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/10987/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/10987/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/10987/events","html_url":"https://github.com/yiisoft/yii2/issues/10987","id":137301951,"number":10987,"title":"ActiveField: show an error for element array","user":{"login":"nepster-web","id":5681979,"avatar_url":"https://avatars.githubusercontent.com/u/5681979?v=3","gravatar_id":"","url":"https://api.github.com/users/nepster-web","html_url":"https://github.com/nepster-web","followers_url":"https://api.github.com/users/nepster-web/followers","following_url":"https://api.github.com/users/nepster-web/following{/other_user}","gists_url":"https://api.github.com/users/nepster-web/gists{/gist_id}","starred_url":"https://api.github.com/users/nepster-web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nepster-web/subscriptions","organizations_url":"https://api.github.com/users/nepster-web/orgs","repos_url":"https://api.github.com/users/nepster-web/repos","events_url":"https://api.github.com/users/nepster-web/events{/privacy}","received_events_url":"https://api.github.com/users/nepster-web/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-29T16:30:29Z","updated_at":"2016-03-01T08:49:01Z","closed_at":"2016-03-01T08:39:22Z","body":"I have a form:\r\n```\r\n...\r\n<div class=\"row\">\r\n    <div class=\"col-md-4 col-md-4 col-sm-4 col-xs-6 col-lg-4\"><?= $form->field($formModel, 'meta_title['.$lang['code'].']')->textInput(['maxlength' => true]) ?></div>\r\n    <div class=\"col-md-4 col-md-4 col-sm-4 col-xs-6 col-lg-4\"><?= $form->field($formModel, 'meta_description['.$lang['code'].']')->textInput(['maxlength' => true]) ?></div>\r\n    <div class=\"col-md-4 col-md-4 col-sm-4 col-xs-6 col-lg-4\"><?= $form->field($formModel, 'meta_keywords['.$lang['code'].']')->textInput(['maxlength' => true]) ?></div>\r\n</div>\r\n...\r\n```\r\nFor each language in the system I generate a new field.\r\nNext, in my model (extends yii\\base\\Model) I want to do validation data. For example like this:\r\n\r\n```\r\n$this->addError('title[en]', 'Ошибка только для поля с языком en');\r\n```\r\n\r\nBut the error is not show during render a my form. This code:\r\nhttps://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseHtml.php#L2033\r\nalways cuts [*].\r\n\r\nSo there's a possibility validate field `title` only globally.\tThat is all fields `title[*]`.\r\nWhy is not possible to validate only a specific element of the array (example title[en]) ?\r\n\r\n\r\n-------------------------------------\r\n**На случай, если никто не поймет моего топорного английского:**\r\n\r\nУ меня есть форма.  (код выше)\r\nДля каждого языка в системе я генерирую новое поле. Далее в моей моделе (extends yii\\base\\Model), я хочу сделать валидацию данных. Например вот так:\r\n\r\n```\r\n$this->addError('title[en]', 'Ошибка только для поля с языком en');\r\n```\r\nНо при рендере формы ошибка не показывается. Вот этот код:\r\nhttps://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseHtml.php#L2033\r\nвсегда вырезает [*].\r\n\r\nИсходя из этого есть возможность валидировать поле title только глобально, тоесть для всех подключенных полей title[*]. Почему нет возможности валидировать только конкретный элемент массива, например title[en] ?\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/190617335","html_url":"https://github.com/yiisoft/yii2/issues/10987#issuecomment-190617335","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/10987","id":190617335,"user":{"login":"nepster-web","id":5681979,"avatar_url":"https://avatars.githubusercontent.com/u/5681979?v=3","gravatar_id":"","url":"https://api.github.com/users/nepster-web","html_url":"https://github.com/nepster-web","followers_url":"https://api.github.com/users/nepster-web/followers","following_url":"https://api.github.com/users/nepster-web/following{/other_user}","gists_url":"https://api.github.com/users/nepster-web/gists{/gist_id}","starred_url":"https://api.github.com/users/nepster-web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nepster-web/subscriptions","organizations_url":"https://api.github.com/users/nepster-web/orgs","repos_url":"https://api.github.com/users/nepster-web/repos","events_url":"https://api.github.com/users/nepster-web/events{/privacy}","received_events_url":"https://api.github.com/users/nepster-web/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T08:49:01Z","updated_at":"2016-03-01T08:49:01Z","body":"Why validation of the array attribute element is not supported? It is very interesting to me."}}