How To Collect The Tabular Input

while i am using $this->getItemsToUpdate() while collecting the tabular input but i am getting the error that there is no such method wheather the getItemToUpdate() method to be implemented by us or not

here is my code


<div class="row">

<?php echo $form->labelEx($model,‘name’); ?>

<?php echo $form->textField($model,‘name’); ?>

<?php echo $form->error($model,‘name’); ?>


<div class="row">

<?php echo $form->labelEx($model,‘surname’); ?>

<?php echo $form->textField($model,‘surname’); ?>

<?php echo $form->error($model,‘surname’); ?>


<div class="row">

<?php echo $form->labelEx($model,‘email’); ?>

<?php echo $form->textField($model,‘email’); ?>

<?php echo $form->error($model,‘email’); ?>


<div class="row">

<?php $items = array(1,2); ?>

<?php foreach ($items as $i=>$item): ?>

<?php echo $form->textField($modelAddress, ‘[$i]street’); ?>

<?php echo $form->textField($modelAddress, ‘[$i]city’); ?>

<?php echo $form->textField($modelAddress, ‘[$i]state’); ?>

<?php endforeach; ?>


then i should collected the data of the modelAddress field in controller


public function actionBatchUpdate()


$model = new User;

$modelAddress = new Address;




foreach($items as $i=>$item)




$valid=$item->validate() && $valid;


if($valid) // all items are valid

// …do something here


$this->render(‘batchUpdate’, array(

‘model’ => $model,

‘modelAddress’ => $modelAddress,



here how to get the items variable count by implementing the getitemtoupdate() method please help me

You have to implement this function in your controller like

public function getitemstoupdate($user_id)


    //return only models that need update

    &#036;model=Address::model()-&gt;findAll('your condition');

    return &#036;model;


but i want to create form , not update. in find all() this will take from db… give me simple code snippet for this. plz

I want to keep track of more than one in 1 table. But the incoming data is only the first data alone with the following code. Could help me.




			foreach ($siswa as $i=>$ii): 


		<?php echo $form->textFieldRow($model,"[$i]kode_mapel",array('class'=>'span2','maxlength'=>6)); ?>

		<?php echo $form->textFieldRow($model,"[$i]kode_guru", array('class'=>'span2', 'maxlength'=>2)); ?>


		<?php echo $form->hiddenField($model,"[$i]lokal",array('value'=>$ii['lokal'])); ?>

		<?php echo $form->hiddenField($model,"[$i]kelas",array('value'=>$ii['kelas'])); ?>

		<?php echo $form->hiddenField($model,"[$i]nisn",array('value'=>$ii['nisn'])); ?>


				<td><?php echo $ii['nisn']; ?></td>

				<td><?php echo $ii['nama_lengkap']; ?></td>

				<td><?php echo $form->textFieldRow($model,"[$i]na", array('class'=>'input-small', 'id'=>'na')); ?></td>

				<td><?php echo $form->textFieldRow($model,"[$i]un", array('class'=>'input-small', 'id'=>'un')); ?></td>

				<td><?php echo $form->textFieldRow($model,"[$i]uas", array('class'=>'input-small', 'id'=>'uas')); ?></td>


		<?php endforeach; ?>


public function actionCreate()


		$model=new Nilai;




			foreach ($_POST['Nilai'] as $i=>$ii){


					$model=new Nilai;



					$valid2=$model->validate() && $valid;