Sunday, 15 September 2013

In CakePHP the multiple select box is not getting multiple selected based on passed array -



In CakePHP the multiple select box is not getting multiple selected based on passed array -

the problem not able multiple select in multiple select box based on array using in form helper.from controller have passed array called $selected_colors view. done shown below-

$this->set(compact('colors', 'selected_colors'));

on debug($selected_colors); $selected_colors below given array-

array( (int) 0 => '1', (int) 2 => '20', (int) 4 => '21' )

the form helper using in view given below-

$this->form->input('masterarticle.0.color_id', array('type' => 'select', 'multiple' => true, 'options' => $colors, 'label' => false, 'class' => 'input-xlarge', 'selected' => $selected_colors));

please help me solving problem.

this known bug in cakephp < 2.3.1. have stumbled on too. has been fixed in cakephp 2.3.1.

cakephp cakephp-2.1 drop-down-menu

No comments:

Post a Comment