Autocomplete backend text field based on previous values

Hi guys,
currently I ponder over solution to create autocomplete text field in a backend.

Basically I want the text-field, that would suggest some values from previously filled ones in a dropdown. My client has database of few thousand addresses for invoices and when he’s putting new invoice to the system he would like to have this autocomplete. The thing is it can’t be just dropdown alone, because you should be able to fill new address as well. Also I was thinking of creating model for address and than using realtion autocomplete, but addresses that are already in a system are a little mess, so it would be pain to convert it to the other format, and also it would make process of filling address a bit more complicated and strict, which is not really necessary in this scenario.

So creating simple text-field with optional dropdown suggestions of its previous values would work best from my point of view. I searched through the docs, but didn’t find any option like this. Is it possible to do with pure settings or do I need to create custom form widget?

Anyway I am not skilled programmer, and my approach can be also totally wrong, so if someone can point me in the right direction, I would be very grateful.

Thank you in advance

Hi @kiko_balco ,

I understand the challenge—dealing with customer addresses written in various formats can be tricky! To standardize them, you might consider using Embedding and Vector Comparison. I’d be happy to provide more information on that if you need it.

As for the autocomplete feature in the backend form field, it doesn’t seem to be available out-of-the-box. However, you could either create a custom form widget or use a relation manager.

For instance, you could set up a Customer model with a hasMany relationship to the Invoice model. This setup would enable you to search for existing addresses and create new ones if needed.

You can find more details about hasMany relationships here: Relation Controller - October CMS - 3.x