Multiple Activecheckboxlist With 1 Model

Dear all,

has just started out Yii web app and encountered this problem, any suggestions are welcome:)

What i am trying to achieve:

-To display a form with tabs, each tab content contains a list of checkboxes from the same model.

-so user can select some items from tab 1, some from tab 2, etc and then click submit button to process.

Problem:

But i couldn’t think of anyway such that the last tab activecheckboxlist will not clobbered the previous one up.

I am trying to to something similar to this : http://www.yiiframework.com/forum/index.php/topic/20388-2-checkboxlist-and-1-model/

but instead of fixing it at 2, mine is dynamic.

What i have done so far:

  1. in my view form:



        <?php

        $tabArray = array();

        foreach ((Product::model()->listParentChild(0)) as $productparent) {

            array_push($tabArray, array(

                'label' => $productparent['name'],

                'content' => CHtml::activeCheckBoxList(

                        $model, 'products', CHtml::listData(Product::model()->listParentChild($productparent['id']), 'id', 'name'), array(

                    'labelOptions' => array('style' => 'display:inline'),

                    'template' => '<div class="check-option">{input} {label}</div>',

                    'separator' => '',

                        )

                ), 'active' => ($productparent['id'] == 1 ? true : false),

            ));

        }

        ?>   


        <?php

        $this->widget('bootstrap.widgets.TbTabs', array(

            'type' => 'tabs', // 'tabs' or 'pills'

            'placement' => 'left',

            'tabs' => $tabArray,

        ));

        ?>



and in my product model:




        public function listParentChild($parentid) {

        $sql = "SELECT * FROM piki_product WHERE parentid=:parentid";        

        $productlist = Yii::app()->db->createCommand($sql);

        $productlist->bindValue(":parentid", $parentid, PDO::PARAM_INT);

        return $productlist->queryAll();

    }



Really, any help will be appreciated…