I''m using the auto_complete plugin, and it works great, my problem is i need to pass multiple parameters to the controller other that what is typed in the text field. <%= text_field_with_auto_complete :search, :contains, :size => 15, :frequency => 0.1, :skip_style => true -%> This is what i have as of now, but i also need to pass ":language => @default" because two words can have the same spelling in multiple languages and I don''t want to confuse the user. If you know how to pass multiple parameters to the controller using text_field_with_auto_complete, then please let me know. Thanks! -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Jun 13, 2008 at 1:33 AM, Richard Schneeman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m using the auto_complete plugin, and it works great, my problem is i > need to pass multiple parameters to the controller other that what is > typed in the text field. > > <%= text_field_with_auto_complete :search, :contains, :size => 15, > :frequency => 0.1, :skip_style => true -%> > > This is what i have as of now, but i also need to pass ":language => > @default" because two words can have the same spelling in multiple > languages and I don''t want to confuse the user. > > If you know how to pass multiple parameters to the controller using > text_field_with_auto_complete, then please let me know. Thanks!The hash with autocompletion options accepts a standard Ajax :with parameter. For example, you could send an entire form containing the text field this way: :skip_style => true, :with => "$(''my-superb-form'').serialize()" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Xavier Noria wrote:> On Fri, Jun 13, 2008 at 1:33 AM, Richard Schneeman > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> If you know how to pass multiple parameters to the controller using >> text_field_with_auto_complete, then please let me know. Thanks! > > The hash with autocompletion options accepts a standard Ajax :with > parameter. For example, you could send an entire form containing the > text field this way: > > :skip_style => true, :with => "$(''my-superb-form'').serialize()"Right now i have <% form_for :search, @search, :url => { :action => "search"}, :html => {:id => ''my-superb-form'', :name => ''my-superb-form''} do |f| %> <%= f.text_field( :nonsense, :value => "double checking") %> <%= select_tag :language, options_for_select(["English", "French", "Spanish"]) %> <%= text_field_with_auto_complete :search, :contains, :size => 15, :frequency => 0.1, :skip_style => true, :with => "$(''my-superb-form'').serialize()" -%> <% f.submit ''Search'' %> <% end %> when i check my log all i see is Parameters: {"search"=>{"contains"=>"a"}, "authenticity_token"=>"bb42c98bf1b8a9497e1f08b5de88cf06c49dd38c", "controller"=>"phrases", "action"=>"auto_complete_for_search_contains"} I also tried using :with => "''arbitrary_value=''+English" -%> and get the same result, I am using rails 2.0.2 on mac osx 10.5. Thanks for your help so far!! -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
On Sat, Jun 14, 2008 at 4:28 AM, Richard Schneeman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> <%= text_field_with_auto_complete :search, :contains, :size => 15, > :frequency => 0.1, :skip_style => true, > :with => "$(''my-superb-form'').serialize()" -%>The signature of the helper is: text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {}) so you need to separate the option hashes because otherwise everything builds just tag_options: <%# untested, note curlies around :size %> <%= text_field_with_auto_complete :search, :contains, {:size => 15}, :frequency => 0.1, :skip_style => true, :with => "$(''my-superb-form'').serialize()" -%> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
check out this thread: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f17fe9d54c45fa11/ee6938c17684dc20?hl=en&lnk=st&q=auto_complete#ee6938c17684dc20 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 On Jun 12, 2008, at 7:33 PM, Richard Schneeman wrote:> > I''m using the auto_complete plugin, and it works great, my problem > is i > need to pass multiple parameters to the controller other that what is > typed in the text field. > > <%= text_field_with_auto_complete :search, :contains, :size => 15, > :frequency => 0.1, :skip_style => true -%> > > This is what i have as of now, but i also need to pass ":language => > @default" because two words can have the same spelling in multiple > languages and I don''t want to confuse the user. > > If you know how to pass multiple parameters to the controller using > text_field_with_auto_complete, then please let me know. Thanks! > -- > Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Michael Breen wrote:> check out this thread: > > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f17fe9d54c45fa11/ee6938c17684dc20?hl=en&lnk=st&q=auto_complete#ee6938c17684dc20 > > > 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. > mikethis didn''t work <%= text_field_with_auto_complete :search, :contains, {:url => {:action => "auto_complete_for_search_contains", :language => "English" }, :method => :get} %> produced the code 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 -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Just out of curiosity, how is the route defined? best. mike On Jun 14, 2008, at 11:13 AM, Richard Schneeman wrote:> > Michael Breen wrote: >> check out this thread: >> >> http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f17fe9d54c45fa11/ee6938c17684dc20?hl=en&lnk=st&q=auto_complete#ee6938c17684dc20 >> >> >> 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 > > > > this didn''t work > > > <%= text_field_with_auto_complete :search, :contains, > {:url => {:action => > "auto_complete_for_search_contains", > :language => "English" }, :method => :get} %> > > produced the code > > 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 > -- > Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Michael Breen wrote:> Just out of curiosity, how is the route defined? > > best. > mikeActionController::Routing::Routes.draw do |map| map.resources :phrases map.connect '':controller/:action.'' map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' end Not exactly sure if i under stand what you''re looking for so let me know if this isn''t it. -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
This is how I have my autocomplete action defined: map.resources :the_controller, :collection => {:auto_complete_action_name => :get} On Jun 14, 2008, at 12:22 PM, Richard Schneeman wrote:> > Michael Breen wrote: >> Just out of curiosity, how is the route defined? >> >> best. >> mike > > ActionController::Routing::Routes.draw do |map| > map.resources :phrases > map.connect '':controller/:action.'' > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > end > > > > Not exactly sure if i under stand what you''re looking for so let me > know > if this isn''t it. > -- > Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Michael Breen wrote:> This is how I have my autocomplete action defined: > > map.resources :the_controller, :collection => > {:auto_complete_action_name => :get}thats not defined for me in my routes.rb, or in my vendors folder where did you find that? -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
You need to manually define it in your routes.rb: ActionController::Routing::Routes.draw do |map| map.resources :phrases, :collection => {:auto_complete_for_search_contains => :get } map.connect '':controller/:action.'' map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' end have you seen this tutorial http://trix.pl/blog/auto-complete-for-rails-2-0-tutorial.html best. mike On Jun 14, 2008, at 1:32 PM, Richard Schneeman wrote:> > Michael Breen wrote: >> This is how I have my autocomplete action defined: >> >> map.resources :the_controller, :collection => >> {:auto_complete_action_name => :get} > > thats not defined for me in my routes.rb, or in my vendors folder > where > did you find that? > -- > Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---
Thanks a bunch, i didn''t even see your earlier post about the tag options, that was the key, just had to put everything inside of {}. <%= text_field_with_auto_complete :search, :contains, {:size => 15, :frequency => 0.1, :skip_style => true},{:url => {:action => "auto_complete_for_search_contains", :language => @default}} -%> works like a charm, thanks for sticking with me!! -- Posted via http://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 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 -~----------~----~----~----~------~----~------~--~---