0
->add('skills', EntityType::class, array(
                    'class' => ProfileSkills::class,
                    'query_builder' => function (EntityRepository $er) {
                        return $er->createQueryBuilder('s')
                            ->orderBy('s.id', 'ASC');
                    },
                    'choice_label' => 'name',
                    'label' => 'Research keywords',
                    'attr' => array(
                        'placeholder' => 'Please add your research keywords one by one.',
                    )
                ))

For now tihis is working as huge select field. I need to make it smaller by using autocomplete.

Is there is some way to use data from this EntityType as value for jQuery autocomplete or maybe is some option to do on symfony side?

Stevan Tosic
  • 6,561
  • 10
  • 55
  • 110

2 Answers2

2

Using jquery autocomplete you'll have to pass your select values to the script.

source : $('#select input[value]');

Read this post too : Adding JQuery Autocomplete in Symfony2 Entity field

Community
  • 1
  • 1
Shakealot
  • 133
  • 10
2

May I suggest you to use the chosen jQuery plugin ?

It is pretty useful for this kind of situation.

Hugo Soltys
  • 227
  • 1
  • 11