genemu/GenemuFormBundle — Issue #59: Jquery Autocomplete from Entity and custom values
Author: Schyzophrenic
Created: 2012-03-06 00:16:11+00:00
State: open

I tried to setup an autocomplete field, which takes its values from a doctrine Entity with the following code:

```php
->add('name', 'genemu_jqueryautocompleter', array(
'label'	=> 'name',
'class'	=> 'FooBundle:Bar',
'widget'	=> 'entity',
'query_builder' => function (EntityRepository $er) use ($founderId) {
return $er->createQueryBuilder('b')
->where('b.founder = :founderId')
->orderBy('b.name', 'ASC')
->setParameter('founderId', $founderId);
},
'property'	=> 'name',
))
```

As the field correctly displays the values referenced by the entity, it does not work properly when I enter free text.
For instance, if my entity contains "name1" and "name2" and that I type "NewName", it does not work as the form object will be either contain an invalid value (the last value selected from the list) or will be uninitialized if I have never selected a specific value from the list.

Am I doing something wrong here ? Or is it something else?