Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (37 sloc) 1.28 KB

jQuery Select2 Field (view demo)

Enable it in your app configuration :

# app/config/config.yml
    select2: ~

Download the plugin and include its assets :

Default Usage:

You can use all the core choice types from Symfony (choice, country, ...) and Doctrine (ORM and ODM), you just have to prefix the type name with genemu_jqueryselect2_* :

// ...
public function buildForm(FormBuilder $builder, array $options)
        // ...
        ->add('choice', 'genemu_jqueryselect2_choice', array(
            'choices' => array(
                'foo' => 'Foo',
                'bar' => 'Bar',
        ->add('country', 'genemu_jqueryselect2_country')
        ->add('entity', 'genemu_jqueryselect2_entity', array(
            'class' => 'MyBundle\Entity\Class',
            'property' => 'name',

For more information on options available for each type, cf. to this form type documentation.


  1. Ajax
  2. Configuration example
You can’t perform that action at this time.