渲染部分表格

Is there any way to render partial view which contains a part of form that it's main part is in another view file with AJAX?

I exactly mean one form variable:

`<?php $form = ActiveForm::begin(['enableAjaxValidation' => true,]); ?>`

For Example :

Controller

public function actionOlddetform()
    {
        return $this->renderAjax('_olddet');
    }

View

<?php $form = ActiveForm::begin(['enableAjaxValidation' => true,]); ?>

<?= $form->field($model, 'date')->input() ?>
<?= $form->field($model, 'annotations')->textarea(['rows' => 3]) ?>

<div id="details-form"></div>

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

Part of form included with AJAX for details-form container depends on date value. I know how to check date and show any content of that partial view but when I want to include a part of form I get an error:

PHP Notice 'yii\base\ErrorException' with message 'Undefined variable: form' 

It seems you forgot to actually pass the model into your view:

public function actionOlddetform()
{
    return $this->renderAjax('_olddet', ['model' => $dataModel]);
}

And if you want to render "sub-views" from your main view, you need to pass the variables in there as well (even though I don't see a render call in your view):

<?= $this->render('_formPart', ['form' => $form, 'model' => $model]) ?>