symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
845 stars 307 forks source link

[Autocomplete] Implement re-using the same AJAX endpoint for TextType based field autocomplete #927

Open psihius opened 1 year ago

psihius commented 1 year ago

Right now you are required to make your own autocomplete endpoint when using a TextType field (as per documentation and in practice). In many cases all you want is just the data to be stuck into the text field - in my case, it's a company name. So you can reuse the same entity lookup code, just return the same data for the value that is returned for text in this case.

I have a table where I import on daily basis the registry of all active companies for my country, it's used as a dictionary for autocomplete to speed up the lookup and reduce mistakes by users, I can also pre-fill some other fields in the form by doing some JS (like pre-fill company address, registration data, etc), but it also allows entering anything into the field (an international company for example) - I do not need strict entity validation on the backend, nor do I even want to link to that dictionary table - I am creating an actual proper company record from the form that's being filled in.

axel37 commented 1 year ago

I recently had the need for a similar field :

+ Some requirements asking for ability to configure said field :

autocomplete field

weaverryan commented 1 year ago

Yea, I like this idea too.

carsonbot commented 6 months ago

Thank you for this suggestion. There has not been a lot of activity here for a while. Would you still like to see this feature?

carsonbot commented 5 months ago

Friendly ping? Should this still be open? I will close if I don't hear anything.

axel37 commented 5 months ago

It seems to me that this is still relevant (?)