autocomplete with add new options?

I have a conceptual issue and hope for the help of this community.

In my application I have a model, let’s say manufacturers, and in a form I want the user to enter in a field a manufacturer for a specific product.

So he should get proposals for the known manufacturers from the model when he starts entering the name, but if he enters a new name, this should be also stored in the database.

I have no idea, how to solve this. I looked for jui autocomplete and the kartik select2 widget (http://demos.krajee.com/widget-details/select2), which seems to be quite near to my ideal solution.

Can you give me some hints, how you would solve this request?

Thank you in advance.

Hi!

Sounds like a Job for "Typeahead":

Demo:

http://demos.krajee.com/widget-details/typeahead

Regards

Thank you for your hint, which seems to be a very good solution! :)

Unfortunately I’m actualy struggling with many-to-many saving before I can really test it in my project.

Any hints here also?

If i understood what you need, i guess you can use jquery/javascript on blur or on change method and then with an ajax call insert the new value in the db