auto_complete

3 views
Skip to first unread message

Indra M.

unread,
Jun 4, 2008, 7:53:07 AM6/4/08
to rubyonra...@googlegroups.com
Hello,

is there any way to pass additional parameters (e.g. a string) from the
text_field_with_auto_complete to the controller?

Indra
--
Posted via http://www.ruby-forum.com/.

Michael Breen

unread,
Jun 4, 2008, 8:11:33 AM6/4/08
to rubyonra...@googlegroups.com
You can use the :url option. The symbols you set after :action will be
appended to the querystring.

<%= text_field_with_auto_complete :my_field, "Enter some text", {:url
=>{:action => 'auto_complete_action_name', :my_param =>
"hello"}, :method => :get} %>

best.
mike

Indra M.

unread,
Jun 4, 2008, 8:34:54 AM6/4/08
to rubyonra...@googlegroups.com
Thank you!
That's exactly what I was looking for.

SnowmanInTheSun

unread,
Jun 14, 2008, 11:14:40 AM6/14/08
to Ruby on Rails: Talk
this didn't work for me


<%= text_field_with_auto_complete :search, :contains,
{:url => {:action =>
"auto_complete_for_search_contains",
:language => "English" }, :method => :get} %>

produced

Parameters: {"search"=>{"contains"=>"a"},
"authenticity_token"=>"2c9f26a81557318a3d7ce1ff64bc57bea43c5fdc",
"controller"=>"phrases",
"action"=>"auto_complete_for_search_contains"}

i tried pretty much every combination of :url :html and curley braces
that is humanly possible and nothing seemed to work, any suggestions?



Rails 2.0.2 running
script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete


On Jun 4, 8:34 am, "Indra M." <rails-mailing-l...@andreas-s.net>
wrote:
Reply all
Reply to author
Forward
0 new messages