PUGX / PUGXAutoCompleterBundle

Add an autocomplete field to your Symfony forms
GNU Lesser General Public License v3.0
93 stars 38 forks source link

Can't make it working with Select2 4.0 #18

Closed robert-halas closed 4 years ago

robert-halas commented 9 years ago

Hi, I can't make bundle working Select2 4.0 version (https://select2.github.io/), it now uses select instead of hidden text field. Im populating select2 field with ajax call and ajax is not working when I type something. I tried to modify AutocompleteType to set its parent type to choice, then ajax works but then nothing is passed to data transformer and it cant transform id to object and vice versa. When I dump request id is there but form->handleRequest won't accept value and nothing is passed to form or transformer (nothing in dump). Maybe choice type needs other data format but I cant make it work.

garak commented 9 years ago

The current implementation is known to work only with older version of Select2. I guess we need to add another Javascript file (I don't know much of Select2 4, but I guess is incompatible with Select2 3). If you want/can do a pull request, you'll be more than welcome

garak commented 8 years ago

I see that indeed it's not just a matter of javascript. Select2 changed its approach, and using a select is problematic because Symfony doesn't accept values for a choice type, unless values were originally in the same choice type. There are some workarounds to get it working, see SO, but at this point it looks to me that it's not worth the pain of a rewriting. Just stay with old version of Select2.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue is closed because was marked as stale and had no activity. Thank you for your contributions.