开发者

Symfony (1.2) multiple checkbox widget

开发者 https://www.devze.com 2022-12-14 23:51 出处:网络
I want understand what the widget can I use to generate such html: <input name=\"users[]\" value=\"Robert\" type=\"checkbox\"> Robert

I want understand what the widget can I use to generate such html:

<input name="users[]" value="Robert" type="checkbox"> Robert
<input name="users[]" value="Bob" type="checkbox"> Bob

Or perhaps symfony doesn't have that widget and I have to write it mys开发者_C百科elf? Thanks


Check this: http://www.symfony-project.org/forms/1_2/en/A-Widgets#chapter_a_sub_choice_representations

As they explain, you may try this code:

$w = new sfWidgetFormChoice(array(
  'expanded' => true,
  'multiple' => true,
  'choices'  => array('A week of symfony', 'Call the expert', 'Community'),
));

It will produce this:

Symfony (1.2) multiple checkbox widget


(source: symfony-project.org)


Yeah! I found it! It is sfWidgetFormSelectCheckbox that widget I find

0

精彩评论

暂无评论...
验证码 换一张
取 消