Answer the question
In order to leave comments, you need to log in
Why is the form generating so many requests?
Created a form using ActiveForm and wrapped in pjax:
<?php Pjax::begin(['enablePushState' => false, 'timeout' => false, 'id' => 'addTaskPjax']) ?>
<?php $form = ActiveForm::begin([
'options' => [
'data-pjax' => '',
'id' => 'formAddTask',
'onSubmit' => 'formSubmit()' // удаляет кнопку "добавить"
]
]) ?>
<div class="card-content white-text">
<span class="card-title" style="font-size: 20px">Добавить задачу</span>
<?= $form->field($model, 'name', [
'labelOptions' => [
'style' => 'font-size: 14px'
]
])->textInput(
[
'style' => [
'color' => 'white'
]
]) ?>
<?= $form->field($model, 'description', [
'labelOptions' => [
'style' => 'font-size: 14px'
]
])->textarea([
'style' => [
'resize' => 'none',
'height' => '300px'
]
]) ?>
<label style="font-size: 14px; color: white">Привлечь работников</label><br>
<?php foreach ($users as $user): ?>
<label>
<input type="checkbox" class="filled-in" name="workers[]" value="<?= $user->id ?>"/>
<span style="font-size: 14px; color: white; margin-left: 10px"><?= $user->last_name ?>
(<?= $user->login ?>)</span>
</label>
<?php endforeach; ?>
<div class="card-action">
<?= Html::submitButton('Добавить', [
'class' => 'waves-effect waves-light btn',
'id' => 'submitAddTask'
]) ?>
<br>
<?php if ($message): ?>
<div class="card-panel red lighten-2"> <?= $message ?> </div>
<?php endif; ?>
</div>
<?php ActiveForm::end() ?>
</div>
<?php Pjax::end() ?>
Answer the question
In order to leave comments, you need to log in
Perhaps you have a loop in this place:
'onSubmit' => 'formSubmit()' // удаляет кнопку "добавить"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question