auto_complete_for not reading from the database?

Can anyone who has used it give me some advice as to where the problem

> could be?
> Thank you very much in advance!!

One thing they leave out from the sample is the CSS, you need to add this CSS to your layout...
(Change the class names to suit).

div.auto_complete {
   border:1px solid #888;
ul.auto_complete {
   list-style-type: none;
ul.auto_complete li.selected { background-color: #ffb; }{
   list-style-type: none;
} {
} div.location {

also in your code you need to change places to place

> <div class="location"><%=h places.location %></div>
> <div class="location"><%=h places.state %></div>

places here should be place. (You may want a different class name on each of these)

and lastly if you see a large amount of space in the autocomplete box after selecting something you need to add the name of the class you want to insert in the text box after selecting...

<%= text_field_with_auto_complete :place, :location, {},
     {:select => 'location', :skip_style => true} %>

See if that helps.

Jacquie Fan wrote:

Jacquie Fan wrote:

Oops! Now I know how dumb my question is. its working like magic now. and I also added

#list li {
      border:1px solid #888;

to get the cursor selecting from those options.

Thanks very much Jim. saved me heaps of time.

Thank you again!!! =D

No Problem, it was not a dumb question, I had just spent 4 hours getting that to work properly, with custom drop downs, in addition to getting multiple autocomplete fields on the same page to work with indexes :slight_smile: