Answer the question
In order to leave comments, you need to log in
How to prevent form auto submit?
Hello,
If I fill out my authorization form (login / password) and do not click on the submit button, the form is still submitted.
view:
<?php
$form = ActiveForm::begin([
'id' => 'login-form',
'enableAjaxValidation' => true,
'action' => ['user/login']
]);
?>
<?= $form->field($loginModel, 'phone')->textInput(['placeholder'=>'Номер телефона', 'autocomplete'=>'off'])->label(false) ?>
<?= $form->field($loginModel, 'password')->passwordInput(['placeholder'=>'Ваш пароль', 'autocomplete'=>'off'])->label(false) ?>
<?= Html::submitButton(Yii::t('app', 'Sign in'), ['class' => 'btn btn-brand btn-block']) ?>
<?php ActiveForm::end() ?>
Answer the question
In order to leave comments, you need to log in
enableAjaxValidation - validation is started via ajax. Either turn it off or make a separate validation route.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question