Getting data from a CGridView

I have a CActiveForm which amongst other things contains a CGridView which is populated from a database model. The CGridView has check boxes for a customer to select which items they want to buy. How would I get a list of checked items into the page controller when the form’s submit button is pressed. To my understanding the only way to do this is to have a corresponding variable in the form’s model, which I can’t do because all the data that populates the CGridView is not collected until the page runs.

I have included my CGridView and the pages controller in case it helps:

CGridView:




$dataProvider=new CActiveDataProvider('data_products', array('criteria'=>array('condition'=>'dataRequestType=0') ) );


$this->widget('zii.widgets.grid.CGridView', array(

    'dataProvider'=>$dataProvider,

    'columns'=>array(

        'program_name',

        'mediaCount',

        'mediaType',

        'productName',

        'dataRestrictions',

        array(

        'name'=>'',

        'value'=>'($data->mediaType == "Downloadable") ? CHtml::link($data->mediaType, $data->mediaType) : CHtml::checkBox("cid[]",null,array("value"=>$data->productName,"id"=>$data->productName))',

        'type'=>'raw',

        'htmlOptions'=>array('width'=>5),

        ),


    ),

));



Controller:




        public function actionIndex()

        {

                $model=new CustomerForm;


                if(isset($_POST['CustomerForm']))

                {

                        $model->attributes=$_POST['CustomerForm'];

                        if($model->validate())

                        {

                                //mail(to,subject,message,headers,parameters)

                                mail(Yii::app()->params['adminEmail'],$model->name,$model->address);              

                        }

                }


                // renders the view file 'protected/views/site/index.php'

                // using the default layout 'protected/views/layouts/main.php'

                $this->render( 'index',

                        array('Programs' => data_products::model()->uniquePrograms(),

                                'Products' => data_products::model()->findAll(),

                                'List' => data_products::model()->alphList(),

                                'model'=>$model)

                );

        }



Thanks

Bump