S
S
Sergey2015-03-20 00:13:31
JavaScript
Sergey, 2015-03-20 00:13:31

How to update form validation on frontend in yii2?

I have a form and after validation I do some jquery + ajax stuff. Everything is ok, but it only works once, when I use the method. Because, apparently, the form has already been validated and the event does not occur a second time when the button is clicked and submitted. I just can’t use it either, because then the form is sent twice (the first time for validation, the second time for sending data), and then my code will be executed twice. How it is possible to bypass this problem? What are the general methods of working with js with yii2 forms? .on('afterValidate', function ()
.on('submit'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-03-23
@butteff

I made a beforeSubmit event, not exactly what I wanted, but that's how it works. Validation goes on the backend, including, if something goes wrong, I return an error, which I then process on jquery. Such is the crutch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question