yii.activeform.js - how to use the validate property?


(Talofo) #1

In Yii 2.0, we add form elements using $(’#myform’).yiiActiveForm(‘add’, attribute) - this is great.

But, in order to trigger and display the validation messages, after an Ajax call, we seem to need to use the validate function, that is an attribute of attributeDefaults, as we can see here:

Can anyone please share an example on how use/invoque this validate property, after an ajax partial view load?

Here’s a try we made:

But, as you can see, this is really a time consuming task for each form field!!

Can anyone advice on this subject?


Erro Banco de dados