Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Не работает подсветка ошибок при валидации вновь добавленных полей #367

Closed
badtiger opened this issue Jan 20, 2022 · 1 comment

Comments

@badtiger
Copy link

После добавления нового поля, для него не работает валидация.
Если производить изменения уже сохраненных полей, происходит enableAjaxValidation и мой валидатор работает. Но если я клонирую какое-то поле, или добавлю новое, то событие для его проверки вновь добавленного поля не работает. При этом, при изменении существующих полей с бакенда приходит ошибка о некорректности клонированного поля, но в представлении это никак не показывается.

Сам код:

<?php $form = ActiveForm::begin([
                        'id' => 'update-stage',
                        'action' => '/admin/production/stage/update/' . $stage->id,
                        'enableAjaxValidation' => true,
                        'options' => ['data-pjax' => true],

                    ]); ?>

                    <?= $form->field($stage, 'stageNorm', [])->widget(MultipleInput::class, [
                        'id' => 'update-stage-norms',
                        'sortable' => true,
                        'min' => 0,
                        'attributeOptions' => [
                            'enableAjaxValidation' => true,
                        ],
                        'columns' => [
                            [
                                'name' => 'stage_id',
                                'type' => MultipleInputColumn::TYPE_HIDDEN_INPUT,
                                'defaultValue' => $model->id,
                            ],
                            [
                                'title' => Yii::t('app/stage', 'Количество людей'),
                                'name' => 'people_count',
                                'value' => function ($data) {
                                    return $data->people_count;
                                },
                                'type' => 'textInput',
                                'enableError' => true,
                            ],
                            [
                                'title' => Yii::t('app/stage', 'Мощность'),
                                'name' => 'value',
                                'value' => function ($data) {
                                    return $data->value;
                                },
                                'type' => 'textInput',
                                'enableError' => true,
                            ],
                        ],
                    ])->label(false); ?>

                    <?= Html::submitButton(
                        Yii::t('app/buttons', 'Обновить этап'),
                        ['class' => 'btn btn-primary font-weight-bolder btn-block']
                    ) ?>

                    <?php ActiveForm::end(); ?>

Сама форма завернута в Pjax, если это имеет значение.

@unclead
Copy link
Owner

unclead commented Jan 29, 2022

thx for reporting this issue. It was fixed in 2.27.0 (fresh release)

@unclead unclead closed this as completed Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants