forked from Baha2Odeh/yii2-recaptcha-v3
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
When doing an ajax validation, i submit an empty form and the input shows an error. with class invalid like this
class=form-control form-control-lg is-invalid"
when i put a valid integter. it changes to
class=form-control form-control-lg is-valid"
then when i enter an invalid integer again, it doesn't change to is-invalid. It works fine before i used this plugin. Any idea why?
here is my javascript submit
<script>
$(document).ready(function () {
var $form = $("#<?= $model->formName() ?>");
$form.on("submit", function (event, messages) {
event.preventDefault();
$.ajax({
"type":"POST",
"url":$form.attr('action'),
"data":$form.serialize(),
"dataType":"json",
"cache": true,
"success":function(data){
$("#tax").html(data.rtax);
},
"statusCode": {
429: function() {
alert("Exceeded request limit.");
}
}
});
return false;
});
});
</script>
my form
<?php
$form = ActiveForm::begin([
'id' => $model->formName(),
'enableAjaxValidation' => true,
'enableClientValidation'=> false,
'validateOnBlur' => false,
'validateOnChange' => false,
'options' => ['autocomplete' => 'off'],
]);
?>
<?= $form->field($model,'bla',
['template' => '
{label}
<div class="input-group mb-3">
{input}
<div class="input-group-append">
<span class="input-group-text">%</span>
</div>
{error}
</div>
{hint}
'])->textInput(['class' => 'form-control form-control-lg']); ?>
<?php echo $form->field($model, 'reCaptcha')->widget(\kekaadrenalin\recaptcha3\ReCaptchaWidget::class) ?>
<?= Html::submitButton(Module::t('app', 'Calculate'), array('buttonType'=>'submit', 'class' => 'btn btn-lg btn-success btn-block shadow-sm')); ?>
<?php ActiveForm::end(); ?>
Metadata
Metadata
Assignees
Labels
No labels