T
T
teodor7teodor72016-06-30 14:16:46
Yii
teodor7teodor7, 2016-06-30 14:16:46

How to fix Yii2, jQuery(...).yiiActiveForm is not a function?

Tell me, when placing the ActiveForm widget on the page, the error jQuery (...) is displayed. yiiActiveForm is not a function. In this case, validation does not work. How to fix it.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Skrolea, 2016-06-30
@Skrolea

Did you include your script manually?

M
Maxim Timofeev, 2016-06-30
@webinar

Apparently, the form scripts were not connected. Show how you get it.

T
teodor7teodor7, 2016-06-30
@teodor7teodor7

......  <?=

ModalCreateUserForm::widget([
  'model' => $model,
  'userRole' => "Администратор"
]);
?>.....

Widget in the view
....

    $form = ActiveForm::begin(['options' => ['class' => 'panel-body'], 
      'id' => 'createUserForm',
      'enableAjaxValidation' => true,
      'enableClientValidation' => true,
      'validationUrl' => Url::to(['create-user-admin'])
   
      ]);

//    $form = ActiveForm::begin([
//      'action' => Url::to(['users']),
//      'options' => ['class' => 'panel-body'  ] , 
//      'id' =>  'createUserForm',
//      'method' => 'POST',
//      'ajaxDataType' => 'x-www-form-urlencoded',
//      'enableAjaxValidation' => true]);

    echo Html::beginTag('div', $options = ['class' => 'form-group']);

    echo $form->field($this->model, 'login')->input('login')
      ->label('Логин');


    echo Html::endTag('div');

    echo Html::beginTag('div', $options = ['class' => 'form-group']);

    echo $form->field($this->model, 'fullName')->input('login')
      ->label('Ф.И.О.');


    echo Html::endTag('div');
    echo Html::beginTag('div', $options = ['class' => 'form-group']);

    echo $form->field($this->model, 'email')->input('email')->label('E-mail');

    echo Html::endTag('div');

    echo Html::beginTag('div', $options = ['class' => 'form-group']);
    echo $form->field($this->model, 'password')->passwordInput()->label('Пароль');

    echo Html::endTag('div');

    echo Html::beginTag('div', $options = ['class' => 'form-group']);

    echo $form->field($this->model, 'confirmPassword')->passwordInput()->label('Подтваердить пароль');

    echo Html::endTag('div');
    echo Html::beginTag('div', $options = ['class' => 'modal-footer']);
    echo Html::a($text = 'Close', $url = "#", $options = [
      'class' => 'btn btn-white',
      'data-dismiss' => 'modal'
    ]);
    echo Html::submitButton('Создать', ['class' => 'btn btn-primary']);
    ActiveForm::end();....
The piece of the widget itself

S
seacjs, 2017-06-09
@seacjs

Most likely, you have a duplicate jquery connection. Look, you have a script connected in Layout manually or through Asset.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question