0

I am working on a Symfony form where it must have a dropdown with checkboxes to select multiple values. However choice and entity input types have 'multiple' and 'expanded' attributes which cannot produce what I need. Shown below is my requirement.

enter image description here

Here's how my form is:

$form = $this->createFormBuilder()
    ->add('features', 'choice', array('choices'=>array('a','b','c'), 'multiple'=> true))
    ->getForm();

Above code produces an expanded dropdown with a multi select.

1
  • There is not a single question mark in the above text. So what are you asking? Commented Apr 11, 2018 at 8:10

2 Answers 2

1

you have to use a JS library like https://github.com/ehynds/jquery-ui-multiselect-widget.

You can find the answer here : How to use Checkbox inside Select Option

Sign up to request clarification or add additional context in comments.

Comments

0

for creating check box with opportunity check one box, you can use this

        $builder
        ->add('check_box', ChoiceType::class, [
            'label' => 'status',
            'multiple' => false,
            'expanded' => false,
            'choices' => [a, b, c],
            'translation_domain' => 'common',
            'label_attr' => ['class' => 'cursor_text'],
            'attr' => [
                'style' => 'some style'
            ]
        ]);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.