title: yii.validation is not defined error in yii2
body: <p><a href="https://i.stack.imgur.com/lRPKU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lRPKU.png" alt="enter image description here"></a></p>
  
  <p>I am opening a ActiveForm in modal window in yii2.
  This error comes when I am opening a ActiveForm in Modal window . my index.php is </p>
  
  <pre><code>&lt;?php
  
  use yii\helpers\Html;
  use yii\bootstrap\Modal;
  
  $this-&gt;title = 'Roles';
  $this-&gt;params['breadcrumbs'][] = $this-&gt;title;
  ?&gt;
  &lt;div class="role-index"&gt;
  
      &lt;h1&gt;&lt;?= Html::encode($this-&gt;title) ?&gt;&lt;/h1&gt;
  
      &lt;p&gt;
          &lt;?= Html::a('Create Role', '#', [
              'class' =&gt; 'btn btn-success',
              'id' =&gt; 'create-role-model',
              'data-toggle' =&gt; 'modal',
              'data-target' =&gt; '#activity-create-modal',
          ]) ?&gt;
      &lt;/p&gt;
  
  &lt;/div&gt;
  &lt;?php
  
  Modal::begin([
      'id' =&gt; 'activity-create-modal',
      'header' =&gt; '&lt;h2&gt;Hello world&lt;/h2&gt;',
      'footer' =&gt; Html::button('Close', ['class' =&gt; 'btn btn-default', 'data-dismiss' =&gt; 'modal'])
          . PHP_EOL . Html::button('Add', ['class' =&gt; 'btn btn-primary btn-modal-save']),
  ]);
  
  $model= new \frontend\models\Role();
  echo $this-&gt;renderAjax('_form',['model' =&gt; $model]);
  
  Modal::end();
  
  ?&gt;
  </code></pre>
  
  <p>and my _form.php is </p>
  
  <pre><code>&lt;?php
  
  use yii\helpers\Html;
  use yii\bootstrap\ActiveForm;
  
  /* @var $this yii\web\View */
  /* @var $model frontend\models\Role */
  /* @var $form yii\widgets\ActiveForm */
  ?&gt;
  
  
      &lt;?php $form = ActiveForm::begin([
          'id' =&gt; 'create-ro',
          'enableClientValidation' =&gt; true,
      ]); ?&gt;
  
      &lt;?= $form-&gt;field($model, 'id')-&gt;textInput(['maxlength' =&gt; true]) ?&gt;
  
      &lt;?= $form-&gt;field($model, 'created_on')-&gt;textInput() ?&gt;
  
      &lt;?= $form-&gt;field($model, 'updated_on')-&gt;textInput() ?&gt;
  
      &lt;div class="form-group"&gt;
          &lt;?= Html::submitButton($model-&gt;isNewRecord ? 'Create' : 'Update', ['class' =&gt; $model-&gt;isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?&gt;
      &lt;/div&gt;
  
      &lt;?php ActiveForm::end(); ?&gt;
  </code></pre>
  
  <p>However when I place ActiveForm without render in index.php Yii Validation is working.Am I doing it an wrong manner . What have to be done so that modal validation start</p>