L
L
Leopandro2016-02-24 12:19:07
Yii
Leopandro, 2016-02-24 12:19:07

Why does this error occur(Pjax)?

Trying to load ActiveForm via pjax

<? \yii\widgets\Pjax::begin()?>
<div class="client-index">

    <h3><?= Html::encode($this->title) ?></h3>
    <p>
        <?= Html::a(Yii::t('app', 'Create client'), ['create'], ['class' => 'btn btn-success', 'id' => 'create_client']) ?>
    </p>
    <?= ListView::widget([
    'dataProvider' => $dataProvider,
    'options' => [
        'tag' => 'div',
        'class' => 'list-wrapper',
        'id' => 'list-wrapper',
        ],
    'layout' => "{summary}\n{pager}\n{items}",
    'itemView' => function ($model, $key, $index, $widget) {
        return Html::a($model->name, ['/client/view'.'?id='.$model->id], ['class'=>'btn btn-default']);
        //return Html::a('button', $model->name, ['type' => 'button', 'class' => 'btn btn-sm btn-default', 'id' => $model->id]);
    }
    ]);
    ?>
</div>
<? \yii\widgets\Pjax::end() ?>

Controller:
public function actionCreate()
    {
        $model = new Client();
        $model->user_id = Yii::$app->user->identity->getId();
        if (Yii::$app->request->isAjax)
        {
            return $this->renderAjax('create', [
                'model' => $model,
            ]);
        }

after loading the page, the message Uncaught TypeError appears in the console
: jQuery (...). yiiActiveForm is not a function
Naturally, the form does not work. What could be causing this and what needs to be done?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leopandro, 2016-02-24
@Leopandro

I solved the problem by connecting js files explicitly, they were not loaded when requested ... or they were loaded incorrectly.

N
Nikita, 2016-02-24
@bitver

Trying to load ActiveForm

Where?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question