dongmaijie5200 2015-08-13 07:42
浏览 8

multiheckbox上有多个setValue

I'm currently working on a Zend 2 project and I have some problems for setValue on multicheckbox with variable.

So, I have an array with all my values to pass in setValue (the values are correct for example I have : 1|6|7 ). Now I want to use the function setValue for checked box :

$form->get('checklist_days')->setValue(array($arrayDays));

But with this, It's checked only the last box (7 in the example above) in the array and not all the boxs in the array... How to deal with that ?

Thanks per advance!

PokeRwOw

  • 写回答

1条回答 默认 最新

  • dongxingqiu7943 2015-08-13 09:44
    关注

    Change $form->get('checklist_days')->setValue(array($arrayDays));

    to this $form->get('checklist_days')->setValueOptions(array($arrayDays));

    setValue() is used to populate a single element, while setValueOptions() is used to populate multiple elements.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题