Has Many tabular input form

Hi,

I am newbie to Yii framework and it is very good MVC framework.

But have a "Has_Many" relationship and i want to develop one form to collect the parent and children models.

i read well the the post at: http://www.yiiframework.com/doc/guide/1.1/en/form.table.

I have model "A" that has many of "B"

Now i developed a form to collect the parent A and a jquery code to add child in the same form.

Every thing is ok for save.

But the problem here in the update when i remove one or more of the child or add a new one.

How can i merge the new child list with the existing one(old child list).

the post at http://www.yiiframework.com/doc/guide/1.1/en/form.table consider only you update the child list but not how to add a new child or to delete on.

You can try some thing like this

//Data to be deleted

$delData = array_diff($oldData, $postData);

//Data to be add

$addData = array_diff($postData, $oldData);

Maybe the extension multimodelform is what you need.

Otherwise, take a look at the sourcecode how to update/delete/add detailitems.