A
A
AlexRas2020-07-27 20:08:12
Yii
AlexRas, 2020-07-27 20:08:12

In yii2, ajax validation blocks opening the form in a new window, how can I fix this?

Hello, I have a form:

<?php $form = ActiveForm::begin([
  'id' => 'order-form',
  'action' => 'site/order',
  'enableClientValidation' => false,
  'validateOnBlur' => false,
  'validateOnChange' => false,
  'enableAjaxValidation' => true,
  'validationUrl' => 'site/order-validate',
  'options' => ['target' => '_blank'],
]); ?>
// Тут разные поля формы
<?= Html::submitButton('Отправить') ?>
<?php ActiveForm::end(); ?>

If you remove 'target' => '_blank', then the form works and the answer opens in the current window. And if available 'target' => '_blank', the browser blocks the pop-up window. How can I make ajax validation work and form result opened in a new window?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question