244863 Posted April 20, 2010 Share Posted April 20, 2010 $options = array_flip(Set::extract('/QuestionnairePossibleAnswer/id', $question)); debug($options); echo $form->input( 'QuestionnaireQuestionnaire.QuestionnaireAnswer.'.$count.'.possible_answer_id', array( 'type' => 'radio', 'options' => $options, 'label' => false, 'legend' => false, 'before' => '<td class="radio">', 'after' => '</td>', 'separator' => '</td><td class="radio">', 'hiddenField' => false ) ); $options = Array ( [4ba8ab7d-9450-45e0-867e-1d7893974a26] => 0 [4ba8ab92-ce20-443e-a23c-1d7893974a26] => 1 [4ba8ab99-3684-4557-ae1e-151093974a26] => 2 [4ba8aba1-6254-40be-932b-1d7893974a26] => 3 [4ba8abab-b4bc-4209-9001-1d7893974a26] => 4 [4ba8abb2-4f64-49d8-8735-1d7893974a26] => 5 ) Why when I view this do I get the 5 radio buttons with the numbers 0 -> 5 next to them as if they are labels??? <input type="radio" value="4ba8ab7d-9450-45e0-867e-1d7893974a26" id="QuestionnaireQuestionnaireQuestionnaireAnswer0PossibleAnswerId4ba8ab7d-9450-45e0-867e-1d7893974a26" name="data[QuestionnaireQuestionnaire][QuestionnaireAnswer][0][possible_answer_id]">0 Link to comment https://forums.phpfreaks.com/topic/199138-cakephp-form-input/ Share on other sites More sharing options...
Philip Posted April 23, 2010 Share Posted April 23, 2010 Well, what does your array originally look like ( Set::extract('/QuestionnairePossibleAnswer/id', $question) )? If it looks like array('test', 'test2') then it makes a lot of sense because array_flip swaps the key/value. So it would become array('test'=>0, 'test2'=>1) Link to comment https://forums.phpfreaks.com/topic/199138-cakephp-form-input/#findComment-1047200 Share on other sites More sharing options...
244863 Posted May 4, 2010 Author Share Posted May 4, 2010 Yes I understand that but why would it print it out even when the legend and label is turned off? Link to comment https://forums.phpfreaks.com/topic/199138-cakephp-form-input/#findComment-1052968 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.