Text_field_with_auto_complete

Hi,

I am trying to use text_field_with_auto_complete, it works fine but
when I click on an item (even if I use the up and down key and then
type enter) th search panel disappears but the selected results is
not shown in the text field. Even more, the text field becomes empty.

Any idea?

Thanks

Sébastien

Hi Sebastien ~

What does your view look like? ~ What does your Controller method have
to
handle the request? ~ What browser are you working in?

Right now it is tough to offer a reason why this isn’t working without
some
more information.

~ Ben

Sorry, I was not very precise

I am on Max OS X - Safari
It’s a simple search for people using their lastname. What will be
perfect is when I click on a name from the result list, I go to the
update page.

** view
<%= text_field_with_auto_complete :search, :name, { :auto_complete =>
“off” }, :skip_style => true %>

** controller
def auto_complete_for_search_name
search = params[:search][:name]
@citizens = Citizen.find( :all, :conditions => [ ‘LOWER(lastname)
LIKE ?’,’%’ + search.downcase + ‘%’ ], :order => ‘lastname
ASC’, :limit => 15)
render :partial => ‘found’
end

** partial html

    <% for citizen in @citizens.to_a -%>
  • <%=h citizen.lastname %>
  • <% end -%>

Thanks
Sébastien

Le 20 janv. 06 à 19:03, Ben R. a écrit :

hi Sebastien,
I am having the exact same problem. Where you able to figure this one
out?
Thanks,
Cagan

Sébastien Gruhier wrote:

Sorry, I was not very precise

I am on Max OS X - Safari
It’s a simple search for people using their lastname. What will be
perfect is when I click on a name from the result list, I go to the
update page.

** view
<%= text_field_with_auto_complete :search, :name, { :auto_complete =>
“off” }, :skip_style => true %>

** controller
def auto_complete_for_search_name
search = params[:search][:name]
@citizens = Citizen.find( :all, :conditions => [ ‘LOWER(lastname)
LIKE ?’,’%’ + search.downcase + ‘%’ ], :order => ‘lastname
ASC’, :limit => 15)
render :partial => ‘found’
end

** partial html

    <% for citizen in @citizens.to_a -%>
  • <%=h citizen.lastname %>
  • <% end -%>

Thanks
Sébastien

Le 20 janv. 06 à 19:03, Ben R. a écrit :