create pjax form inside a active form yii2

826 views Asked by At

I can't create a Pjax form inside an active form. What I've found is that when I put the Pjax inside an active form it doesn't work (it submits the entire page) but when I put it outside the active form its works fine:

<?php
$form = ActiveForm::begin([
        'id' => 'CouplePartnerForm',
        'action' => ['couple-partner/savecouplepartner'],
        'enableAjaxValidation' => true,
        'enableClientValidation' => true,

        'validateOnSubmit' => true,
    ]);
?>

<div class="row">
                    <?php Pjax::begin([]); ?>
  <?= Html::beginForm(['couple-partner/form-submission'], 'post', ['data-pjax' => '0', 'class' => 'form-inline']); ?>
<?= Html::input('text', 'string', Yii::$app->request->post('string'), ['class' => 'form-control']) ?>
<?= Html::submitButton('Hash String', ['class' => 'btn btn-lg btn-primary', 'name' => 'hash-button']) ?>
 <?= Html::endForm() ?>
                    <h3><?= isset($stringHash) ?$stringHash :"" ?></h3>
       <?php Pjax::end(); ?>
</div>
<?php ActiveForm::end(); ?>

So what is the problem here?

0

There are 0 answers