Gathering Tabular Input - Property "Item." is not defined.


I have been trying to gather tabular input. The idea is for me to insert around 6 or 7 records.

i am using this as my guide

I keep getting the error…

Property "Item." is not defined.

this error is from the line

<? echo CHtml::activeTextField($item,"[$i]count"); ?>

Can anybody guide me please ?



Works for me!

You are on 1.1a, right? Syntax change, [$i]attr instead of attr[$i].

Also check that the attribute ‘count’ exists and has the correct case.


No, i am on 1.0.10. actually the attribute is TIMESPENT. and it still complains with that same error.

I managed a hack in this way. Let me know if this is not good.

echo CHtml::activeTextField($item,“TIMESPENT”,array(‘name’=>‘LifeProfile[’.$item->ACTIVITYID.’][TIMESPENT]’) ;



Here is an excerpt from the 1.0.10 guide, the section on tabular input

<div class="yiiForm">

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



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


<td><?php echo CHtml::activeTextField($item,"name[$i]"); ?></td>

<td><?php echo CHtml::activeTextField($item,"price[$i]"); ?></td>

<td><?php echo CHtml::activeTextField($item,"count[$i]"); ?></td>

<td><?php echo CHtml::activeTextArea($item,"description[$i]"); ?></td>


<?php endforeach; ?>


Older versions of the pdf guide are available to download