ActiveForm AJAX validation in dynamic fields

I have developed a form to add emails dynamically (clicking a plus icon) or deleting emails (clicking a minus icon) to a User using Javascript (this is saved in User table)

Each email is saved in a different record in the "Emails" table.

I want to validate this form via AJAX using CActiveForm widget (successful for User fields), however Emails are not being validated via AJAX (as the other fields), this makes sense due this "new" fields have not a "blur" property assigned (this is done by yiiactiveform.js file)

Any one of you know a way to add every new field to the "validation" list in runtime via Javascript in order to validate this dynamic fields too?

Thanks in advance.


I’ve created a function to validate all the children models via AJAX successfully, but I cannot validate the just created items by Javascript.

Any ideas?

Thanks in advance.


Your should use Array type submission of the form i.e. Multiple Forms.




and then validate them by key one by one either using AJAX call or general form submission.