[SOLVED]checkbox values

at the "_resumesofinterests" file, i have this code





<div class="view">

        

        <?php echo CHtml::activeCheckBox($data, 'ResumeID',array('checked'=>false,'value'=>$data->ResumeID));   ?>

	<b><?php echo CHtml::encode($data->getAttributeLabel('ResumeID')); ?>:</b>

	<?php echo CHtml::link(CHtml::encode($data->ResumeID), array('view', 'id'=>$data->ResumeID)); ?>

        <br />


        <b><?php echo CHtml::encode($data->resume->getAttributeLabel('ResumeTitle')); ?>:</b>

        <?php echo $data->resume->ResumeTitle; ?>

        <br/>


        <b><?php echo CHtml::encode($data->resume->getAttributeLabel('ResumeSummaryIntroduction')); ?>:</b>

        <?php echo $data->resume->ResumeSummaryIntroduction; ?>

        <br /><br />

</div>



at the "resumeofinterests" view file that calls that code above, i have this code




<?php echo CHtml::beginForm($action= $this->createUrl('removefromfavorites',array('r'=>'wsrecruitcvhead/removefromfavorites'))); ?>


<?php $this->widget('zii.widgets.CListView', array(

	'dataProvider'=>$dataProvider,

	'itemView'=>'_resumesofinterests',

)); ?>


<?php echo CHtml::submitButton('Removetofavorites',array('value'=>'Remove')); ?>


<?php echo CHtml::endForm(); ?>



Question: how to grab the value of the checked checkboxes ? either it’s only one that’s checked or many…

when I viewed the firebug, it shows this Wsresumesofinterests[ResumeID] as the name of each of the checkboxes :blink:

try


echo CHtml::checkBox("dataModel[ResumeID][{$data->ResumeID}]",false,array('value'=>$data->ResumeID));   

replacing "dataModel" for the model of the dataProvider

with your suggestion, I can now see this




<input type="checkbox" id="dataModel_ResumeID_15" name="dataModel[ResumeID][15]" value="15">



but how will i grab the values at the controller, let’s say I only checked one box, or checked many box and submitted the form ?

in the controller


$_POST['dataModel']['resumeId']

will be an array containing the id’s of the selected checkboxes

thanks, problem solved :)