Im looking for an autocomplete ajax implementation for a textfield.
- you type your city
- it wil look for closest match in db as you type
- as soon as it finds the city (partially search) it displays some options to choose from in format city, state you can pick one from the list and the textfield would contain ” city, state”
What would be good ways of doing this in rails?
I think i need an autocomplete functionality for this with an ajax posting to the app
You can find the relevant JavaScript (assuming you’re using JQuery) here, from there it’s just a matter of setting up a controller action that returns some json and inserting the path to that action to the source: option.
So, very approximately, you’d do something like:
controller:
view: