Collecting tabular input

Hi everyone… :)

I don’t seem to understand these lines of code:




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

<tr>

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

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

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

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

</tr>

<?php endforeach; ?>



then from CHtml::activeTextField and CHtml::activeInputField




$htmlOptions['value']=$model->$attribute;



i believe $attribute = "[$i]name" or am i wrong with this one?

is it equivalent to:

$item->[$i]name??

how’s the value retrieved from this construct??

when i used this method…an error was thrown…

Property "Item." is not defined.

pleas help…anyone…

I have it too. yii 1.09

same version here…it’s weird

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

is currently is not correct.

in chnange log for 1.09 no any word about it. It’s should be right for 1.1…

But it work in 1.09

Right way for tabular is:

<td><?php echo CHtml::activeTextField($model,"login[$n]"); ?></td>

instead

<td><?php echo CHtml::activeTextField($model,"[$n]login"); ?></td>

a ok…tnx so much icevan… ;D