1
votes

I have a module in YII to generate contacts. I have generated checkboxes for each row of the contact list using widget in my admin page.

<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'menu-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'id'=>'autoId',
'class'=>'CCheckBoxColumn',
'selectableRows' => '50',
),
'fname',
'lname',
'email',
'mobile'  
'address',
array(
'class'=>'CButtonColumn',
),
),
)); ?>

I want to create a submit button on this page which saves all the mobile values of the checked rows into database. How do I handle this?

1
create form and add gridview inside the form tag. So you can submit the form and can do necessary action. - Kumar V
Can you plz give me any links to follow up. I am a newbie to YII - user

1 Answers

0
votes

try this code:

$form=$this->beginWidget('CActiveForm', array(
    'id'=>'list_form',
    'enableAjaxValidation'=>false,
    'enableClientValidation'=>true,                 
   )
  );

// place your gridview code here


<?php echo CHtml::submitButton("Search"); ?>
<?php $this->endWidget(); ?>

When submitting form, you will get checkbox values.