Did it using:

$keys = array();
$values = array();

foreach($question['Choice'] as $choice) {
    array_push($keys, $choice['id']);
    array_push($values, $choice['choice']);
}
$choices = array_combine($keys, $values);

The above code is located inside the view... would the controller be a
more appropriate place to put it?
The 'original' choices are still inside the $questions array,
unmodified. If anyone knows a better approach, please post it. Thank
you.

On May 15, 1:42 am, ramonmaruko <ramonmar...@gmail.com> wrote:
> I have the following model associations:
>
> Response->Survey
> Response->Question
> Response->Choice
> Survey->Question
> Question->Choice
>
> I want to create a form where I could answer all the questions for one
> survey. So I used the following to return the needed data:
>
> $questions = $this->Response->Question->find('all',
> array(
>          'conditions' => array('survey_id' =>
> $id),
>          'contain' =>
> array('Choice')
>         )
> );
>
> Sample debug($questions) is athttp://pastebin.com/AL6kNjnC
>
> Questions:
>
> (1) What should I do so that the Choice index returns a find('list')
> format e.g.http://pastebin.com/mMASg1HYso that I could do:
>
> foreach($question as $questions) {
>     $this->Form->select('0.question', $question['Choice']);
>
> }
>
> (2) Is there any way to just use $this->Form->input() to automagically
> create the multiple select fields for the Question->Choice combo?
>
> e.g.
>
> (1) What is your name?
>                        |---------||
>                        |Marco||
>                        |---------||
>                        |Marie ||
>                        |Myka ||
>                        |---------||
>
> (2) Babs si Marie?
>                        |---------||
>                        |Yes   ||
>                        |---------||
>                        |No     ||
>                        |---------||
>
> FWIW, I have $recursion = -1 in my AppModel.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to