Autocomplete a form field
Hi,
i have the following models:
users, markets, assignments, products, sales,
a user gets an assignment, and then he should enter his sales for the assignment.
i have a sales form with the following fields:
quantity, product, price
now i want to autocomplete the product_field with the products from the product model.
only products that are in the database, no new products should get over the sales form.
Any hint how to start this?
thanks
Benny,
Have you looked into collection_select? It will let you make a dropdown for the product_id on the sale form. It'll automatically load up all the Products in the database and create a dropdown for you.
Then you could do something like select2 (https://select2.github.io/examples.html) on that form field to make it do autocomplete.