I have ajax.autocompleter working and I can get the string entered
into the field from the list. But how do I view that selected text
with the ''show'' method? Here is my code:
----- Controller --------
def autocomplete
search = params[:user]
@users = User.find(:all,
:conditions => [ ''LOWER(first_name) LIKE ? OR
LOWER(last_name)
LIKE ?'',
"%#{search.downcase}%", "%#{search.downcase}%" ],
:order => ''first_name, last_name DESC'',
:limit => 8) unless search.blank?
render :partial => "search"
end
------ autocompleter --------
<%= javascript_tag("new Ajax.Autocompleter(''user'',
''user_results'',
''/autocomplete'',
{indicator: ''spinner'',
frequency: 0,
minChars: 1,
}
);") -%>
------- search partial ----------
<ul class="autocomplete_list">
<% for user in @users do -%>
<li class="autocomplete_item">
<div class="name"><%= link_to user.whole_name,
user_path(user) %></
div>
</li>
<% end -%>
</ul>
>From what I''ve read I think I need to use the updateAfterElement
option but I don''t exactly know how. When the text is selected from
the list, I''d like it to invoke the ''show'' medthod
resulting in a url
like: http://domain.com/users/1
Thanks for any help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---