Form validation in renderAjax

Hello,

i load a part of a view with renderAjax. This is my code in the controller:

            return $this->render('index', [
                'model' => $model,
                'groups' => Products::getProductsList($code),
                'editgroup'=>$editgroup,
                'parent'=>Products::getField($code,'parent'),
                'groupChildrens'=>Products::checkChildrens(Products::getField($code, 'id')),
                'showGroupPath'=>Products::showGroupParentPath($model->id),
                'numProductProjects'=>ProjectsProducts::getNumProductProjects(Products::getField($code, 'id')),
                'productData'=>$this->renderAjax('/products/data', [
                        'model'=>$model,
                        'numProductProjects'=>ProjectsProducts::getNumProductProjects(Products::getField($code, 'id')),
                        'groupChildrens'=>Products::checkChildrens(Products::getField($code, 'id')),
                ]),
                'productConfigurator'=>$this->renderAjax('/products/configurator', [
                    'product'=>$model->id,
                    'data'=>ProductsConfigurator::loadConfigurator($model->id),
                    'preview'=>ProductsConfigurator::showConfigurator($model->id),
                    'steps'=>ProductsConfigurator::getSteps($model->id),
                ]),
                'projectList'=>Products::getProjectList($model->id),
        ]);

But then i can’t use ajax validation for a form field. I became the follow error in console:

Uncaught TypeError: yii.validation is undefined

But in the rendered html code, the js-files are loaded:

grafik

And the the functions are set also in the code:
grafik

thanks for tipps

Render the contents of '/products/data' and '/products/configurator' inside 'index' using $this->render('/path/to/products/data/view/file', [...])

Hi emuthomi,

if i do that, there will be generated a complete site with the selected layout. So there is following in the html code:
grafik

And when i use renderPartial, then the embedded Javascript not runs in the site.

i have found a solution. I use now renderPartial and load the optional javascript with another way