在活动表单yii2中创建pjax表单

时间:2016-12-29 12:38:08

标签: php yii2 pjax

我无法在活动表单中创建Pjax表单。我发现当我将Pjax置于活动表单中时它不起作用(它提交整个页面)但是当我将它放在活动表单之外时它的工作正常:

<?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(); ?>

那么这里有什么问题?

0 个答案:

没有答案