hello. I have got the form. I was created it with ActiveForm class. I blocked standart submit with preventDefault(); And afterValidate I submit the form with ajax:
$('#form').on('afterValidate', function () {
var url = $('#form').attr('action');
var data = $('#form').serialize();
$.ajax({
type: "POST",
url: url,
data: data,
});
});
All works good. But only first time, second submit is not working with another data. How I can reset validation of the form after every submit for this good form working with ajax, like I want to see?
And one more question about ajax submit. I submitted the form with the same code, but if I using enctype = ‘multipart/form-data’ it’s not working, yii gives error to me:
PHP Fatal Error 'yii\base\ErrorException' with message 'Call to a member function saveAs() on a non-object
How I can serialize the data with fileinput too?
Thank you