Hello RoR developers do you know how can I get parameter from selection to method from out of form object? I have selection in view page, I have method in controller and I want to get parameter from selection but selection is not in form. how can I get it ?? if you have sample code pls write it with your commend. thank you very much for any help -- 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 -~----------~----~----~----~------~----~------~--~---
tyler.a.montgomery-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-21 16:41 UTC
Re: getting parameter ?
From http://api.rubyonrails.org/ : select(object, method, choices, options = {}, html_options = {}) that''s the basic select tag used to interact with a model...here''s one of my select forms in a view (inside a form tag of course) <%=select(:record, :station_id, Station.find(:all).collect {|p| [ p.name, p.id ] }, { :selected => @station.id }) %> In this example I''m trying to set the station_id method of my record object. I want to be able to select from all my stations (Station.find(:all)) then we collect those stations into a set option tags basically - the interior of the collect takes the text then the value of the option tag ( {|p| [p.name, p.id]} ). Ok so that''s the select tag. Then we access the info from the select tag the same way we access any form parameter in the controller: params[:object][:method] or in my example: params[:record][:station_id] this will get you the value of the option tag you setup in your select tag (be careful to get the correct info into the value and text of the option tags) Hope that helps. T On Feb 20, 8:07 pm, Ibrahim Dogru <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello RoR developers > > do you know how can I get parameter from selection to method from out of > form object? > I have selection in view page, I have method in controller and I want to > get parameter from selection but selection is not in form. how can I get > it ?? > > if you have sample code pls write it with your commend. > > thank you very much for any help > -- > 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 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 -~----------~----~----~----~------~----~------~--~---
thank you very much.. -- 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 -~----------~----~----~----~------~----~------~--~---
> that''s the basic select tag used to interact with a model..the basic select_tag object is the form s object right ???> Ok so that''s the select tag. Then we access the info from the select > tag the same way we access any form parameter in the controller:I m trying to get params[:] from out of form. there is no form in my view page. thank you very much again for your comment. -- 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 -~----------~----~----~----~------~----~------~--~---
I have solution for you. Change your javascript to be storing your wanted params to cookies or session, you can use AJAX. I dont have this script but i have read about it. so you can access that params in your view without form or select_tag. It was 3 days your problem posted without solution, it still continoes up to 7 days your should pay rails consultant for it. (~_~!) ~*~*~*~*~*~*~*~*~*~*~*~*~*~ Reinhart Ariando YM:Booking2Heaven WEB:teapoci.blogspot.com ~*~*~*~*~*~*~*~*~*~*~*~*~*~ -- 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 -~----------~----~----~----~------~----~------~--~---
actually I have many suggestions but I couldnt use any. ajax is another solution but nobody around me knows programming. no chance to consult with anyone. that s why I ask here. I don t have so much time left either. today I need to finish it. quick and certain solutions are preferred. :) thank you very much for your suggestion. -- 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 -~----------~----~----~----~------~----~------~--~---
hey...why you not convert your js to your controller and store it in session you can make new def method for it or new attribute, it think it will be help full and make it has array or hash, then you can call freely in your view. -- 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 -~----------~----~----~----~------~----~------~--~---
Visit Indonesia 2008 wrote:> hey...why you not convert your js to your controller and store it in > session you can make new def method for it or new attribute,could you tell me your suggestion detailed? I couldn t get it well. thank you Ariando,you are so philanthropic. -- 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 -~----------~----~----~----~------~----~------~--~---