Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Appending tabular inputs and validating the form with ajax

$
0
0
Hi, I have a tough question

-I have a CActiveFrom with tabular inputs, configured with 'enableAjaxValidation' => true

-My goal is to dynamically add inputs when pressing on a 'Add button'. This is easy with Chtml::ajax() and a partial

-My issue is that the form does not know that inputs have been added, because the new, ajax-appended inputs were not there when the form widget was created.

How do I re-init $('#the-form').yiiactiveform() so it gets to validate the full list of attributes, the old ones and the ajax-appended ones?

I tried to call $('#the-form').yiiactiveform() from the FireBug console with a different set of parameters, it breaks the validation by disabling it.

Please take note again that my aim is full ajax, both on validation and on appending new form fields.

Thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>