Thanks John. This is the part I didn't get before:

 ...'value' => $arrayItem[yyy]


Again, thank you very much!

Merrill

John Andersen wrote:
What is the structure of your array?
Take your array and pass it to the view using the controllers set
method. Example $this->set('myarray', $myarray);
In the view, write a foreach loop going through the myarray array.
Example:
[code]
foreach( $myarray as $rowNo => $arrayItem )
{
   // Do your presentation here.
   // $form->checkbox('myfield', array('value' => $arrayItem[xxx],
'label' => 'My label');
   // $form->text('myfield2', array('value' => $arrayItem[yyy],
'label' => 'My text label');
}
[/code]

The above is just to get you started, so hope it helps :)
Enjoy,
   John

On Jan 21, 7:52 pm, Merrill Kingston <[email protected]> wrote:
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.


[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