I have 2 forms one ordinary
<form id="payment" name="payment" method="post" action="https://sci.interkassa.com/" enctype="utf-8" target="_blank"> <input type="hidden" name="ik_co_id" value="hdjfhjsdjsdhkj7833jfjsdhf"/> <input type="hidden" name="ik_pm_no" value="ID_<?= rand(1000, 9999) ?>"/> <input type="hidden" name="ik_am" value="<?= $game->price ?>"/> <input type="hidden" name="ik_cur" value="UAH"/> <input type="hidden" name="ik_desc" value="<?= $game->name ?>"/> </form> and one ActiveForm
<?php $form = ActiveForm::begin() ?> <div class="buymail"><?= $form->field($model, 'email')->input('email')->label("E-mail *") ?></div><div class="checkaccept"> <?= $form->field($model, 'accept') ->checkbox([ 'label' => 'Я ознакомлен с пользовательским соглашением и описанием товара*', ]) ?></div> <div class="buybtn"><?= Html::submitButton('Перейти к оплате →', ['class' => 'asbtn subbtnbuy', 'onclick' => 'submitform()', 'disabled' => true]) ?></div> <?php ActiveForm::end() ?> I need to somehow make it so that 1 regular form is sent after successfully filling out 2 forms and clicking on its submit, first did so in js dpsal
function submitform() { document.payment.submit(); } but on submit hung onclick' => 'submitform()' , but so 1 form is sent with any click on submit, regardless of whether the 2nd form passed the validation, then did so set the submit attribute' disabled '=> true, and js wrote
var regex = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; $('#buy-accept').change(function(){ if(regex.test($('#buy-email').val())){ $(".subbtnbuy").prop("disabled", !$(this).is(':checked')); } }); that is, the button will be inactive until the user completes the 2 fields of the form, namely email and checkbox, in principle it works as it should, but no messages will be issued about the empty fields, and then if you tick the box before filling the field with mail will have to remove it again and set to unlock the submit button. This is a question that can be attached to a submission of one form, let’s allow a new window of another form, while transferring 2 forms to work after correctly filling the first one, or how it can be done differently so that 2 forms are sent by pressing 1 submit, but after validation fields of the form in which submit is specified?