Same URLs (actions) to validate and submit an AJAX form


I’m using Yii2.0.8 at the moment.

Is there any standard workflow to achieve the following without any extra interventions from the developer on the client side? And any suggestions how to do it using ‘your coding style’ on the server side?

Imagine, I have an AJAX form (suppose in a Modal window). The ‘AJAX validation’ can be enabled or disabled - it doesn’t matter - as I cannot to rely on it anyway.

The goal is to get the following on submit:

a) if there are any errors they should automatically shown (as it is done when AJAX validation is enabled) – yes, it should be validated, not just saved – but, sorry to repeat myself, it should be done on submit, not on ‘AJAX validation’

B) if there are no errors (it is saved) I should be able to use some flag or something like this (or just rely on empty errors array) to do whatever I want, I mean close the window, or show some message etc.


P.S. I will gladly accept a simple "No, there is still no any standard workflow".

I think you can try setting false to validateOnBlur and validateOnChange of the ActiveForm.$validateOnBlur-detail