这是我的 cakephp 应用程序中的多选菜单代码:
<td><?= $this->Form->select('clothCutting['.$color.'][mtr_str]', ['23'=>'23', '67'=>'67', '24'=>'24'], ['multiple' => true, 'value' => "23", 'label' => false, 'class' => 'table-processed', 'style' => 'width:100%;']) ?></td>
但它只选择一个选项。如果我想让它选择多个选项怎么办?
我尝试将我希望它选择的选项数组放入值属性中,但它不起作用。 像这样:
<td><?= $this->Form->select('clothCutting['.$color.'][mtr_str]', ['23'=>'23', '67'=>'67', '24'=>'24'], ['multiple' => true, 'value' => "[23,67]", 'label' => false, 'class' => 'table-processed', 'style' => 'width:100%;']) ?></td>
我该怎么办?
检查布料切割['.$color.'][mtr_str]选项内的数组构造,试试这个:
<td><?= $this->Form->select('clothCutting['.$color.'][mtr_str]', [23, 67, 24], ['multiple' => true, 'value' => "23", 'label' => false, 'class' => 'table-processed', 'style' => 'width:100%;']) ?></td>
这里有相关文档: