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.

- pat
http://patshaughnessy.net

On Jan 7, 7:02 am, Petr Bobek <[email protected]> wrote:
> Hey everybody,
>
> I am using text field with autocomplete in my posts new action. That
> works great.
> Response from autocompleter in firebug:
> POSThttp://localhost:3001/posts/auto_complete_for_tag_name200 OK 68ms
>
> but if I use the same in edit action it fails and I got this error.
> POSThttp://localhost:3001/posts/781/auto_complete_for_tag_name404 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 ***
> <div id="add_tag">
>   <% 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 %>
> </div>
>
> Thank for your help.
>
> Cheer Pete
> --
> Posted viahttp://www.ruby-forum.com/.
-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to