I had already read and tried that, but as explained in the docs...

"If you need to specify multiple fields using the same field name, thus creating an array that can be saved in one shot with saveAll()..."

This is for displaying an array of rows from a table. This isn't exactly what I need to do.

I need to load data into the controller, process it, and then display an array of results from the processing. So, my need is to display the contents of an array, created by the controller (not the model), one member at a time. The documentation refers to displaying an array of table rows from a model, as in the following example:

<?php echo $form->input('Modelname.0.fieldname');
  echo $form->input('Modelname.1.fieldname');
?>

I tried to treat it as a "group", but that didn't work either.

Using $this->set(compact('data','myarray') does add the array so the view can display it, but if I attempt to loop through "myarray", I get nothing. However, if I just do:

echo $form->input('myarray')

the data is rendered, but into a single field as a drop down list. I need to be able to loop through the array and render each member individually and I haven't been able to get any hints from the docs. For example, I have tried:

for ($i = 0; $i < 42; $i++); {
 echo $form->input('myarray[$i]')
}

My array gets rendered, but without any of the data.

John Andersen wrote:
Please read the following from the CakePHP book:
http://book.cakephp.org/view/189/Automagic-Form-Elements

That should explain a little about passing data as an array to the
view for presentation.
Enjoy,
   John

On Jan 21, 6:49 pm, Merrill Kingston <[email protected]> wrote:
Okay, I've narrowed this down more.

I'm actually trying to render an array, one member at a time. So,
$form->input("something[$i]") doesn't work. I've verified the data is
there, by simply doing $form->input("something") and a single field is
rendered as a drop down list. I have even tried, in the view, to loop
through the array and set a single variable to the current member and
then do a set(), but the value doesn't seem to be available.

So, the question is, how do I render an array one member at a time?


[snip]
------------------------------------------------------------------------

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

--
Merrill Kingston
Phone: 702.798.1806
Fax: 702.522.1455

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to