Text field with autocomplete

Hey everybody,

I am using text field with autocomplete in my posts new action. That
works great.
Response from autocompleter in firebug:
POST http://localhost:3001/posts/auto_complete_for_tag_name 200 OK 68ms

but if I use the same in edit action it fails and I got this error.
POST http://localhost:3001/posts/781/auto_complete_for_tag_name 404 Not
Found 81ms

*** POSTS controller: ***
def auto_complete_for_tag_name
@tag = Tag.find(:all, :conditions => [“name LIKE
?”,#{params[:tag][:name]}%"])
render :inline => “<%= auto_complete_result(@tag, ‘name’) %>”
end

*** posts NEW and EDIT view ***

<% form_remote_tag( :url => {:controller => :tags}, :html => {:id => 'tag_form'}) do %> Name: <%= text_field_with_auto_complete :tag, :name, {:min_chars => 2, :class => "text"} %> <%= submit_tag 'Add' %> <% end %>

Thank for your help.

Cheer Pete

Maybe try form_for instead of form_remote_tag?

I wrote a gem that creates some scaffolding code customized for the
auto complete that might help you get a form working in your app
quickly; see:
http://patshaughnessy.net/2009/10/1/auto_complete-scaffolding
Later you could adapt the scaffolding code to do what you really need.