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
view
<div class="row">
<?php echo $form->labelEx($model,‘name’); ?>
<?php echo $form->textField($model,‘name’); ?>
<?php echo $form->error($model,‘name’); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,‘surname’); ?>
<?php echo $form->textField($model,‘surname’); ?>
<?php echo $form->error($model,‘surname’); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,‘email’); ?>
<?php echo $form->textField($model,‘email’); ?>
<?php echo $form->error($model,‘email’); ?>
</div>
<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; ?>
</div>
then i should collected the data of the modelAddress field in controller
controller
public function actionBatchUpdate()
{
$model = new User;
$modelAddress = new Address;
$items=$this->getItemsToUpdate();
if(isset($_POST[‘Address’]))
{
foreach($items as $i=>$item)
{
if(isset($_POST[‘Address’][$i]))
$item->attributes=$_POST[‘Address’][$i];
$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