With the following ActiveForm config:
<?php $form = ActiveForm::begin([
'id' => 'register-form',
'options' => [
'class' => 'validate-form',
],
'enableClientValidation' => true,
'enableAjaxValidation' => false,
'validateOnSubmit' => true,
'validateOnBlur' => true,
'validateOnChange' => true,
]); ?>
// JS afterValidate function
$('.validate-form').on('afterValidate', function (event, messages, errorAttributes) {
// do something special
return false;
});
Currently the afterValidate()
gets triggered on any validation event. How can I differentiate between the events validateOnSubmit
, validateOnBlur
and validateOnChange
?
Basically, I only want my afterValidate()
function to get triggered on submit.