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

Hello,

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

http://www.yiiframework.com/doc/guide/form.table

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 ?

thanks

Arvind

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.

/Tommy

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]’) ;

thanks

Arvind

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




<div class="yiiForm">

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

<table>

<tr><th>Name</th><th>Price</th><th>Count</th><th>Description</th></tr>

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

<tr>

<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>

</tr>

<?php endforeach; ?>

</table>



Older versions of the pdf guide are available to download

http://www.yiiframework.com/files/yii-docs-1.0.10.tar.gz

http://www.yiiframework.com/files/yii-docs-1.0.10.zip

/Tommy