Reputation: 9666
I've made a web form and i need some of the fields to come up with a dynamic list as the user is typing their input. the list needs to come from a separate table and fill in other corresponding fields if one of the options is taken. i know this is a very vague question but i'm new to ruby so if anyone can give me the easiest/simplest way to do this that'd be awesome!
Upvotes: 0
Views: 1937
Reputation: 10769
I think the easiest/simplest way to do this
is using the gem rails3-jquery-autocomplete. The documentation is very good, which facilitate its implementation.
Just follow the instructions and voilà!
Upvotes: 0
Reputation: 12251
Create a route that outputs JSON. The controller for the route takes an input param (the user's input) and returns values from the database based on that. In the most recent one I did I used a JQuery autocomplete plugin to send the input from the field via ajax to that route and use the return value in the field's drop down.
Upvotes: 2