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.
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)
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. (~_~!)
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.
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.
I just wanna ask whether i can call a function from my view and pass
some parameters within. For the example, i have function setDirections
that when i call using “setDirections(“new york”, “boston”, “en_US”);”
command run smoothly… but what i need is to replace “new york” and
“boston” with session[:address1] and session[:address2]…
Do you have any opinion about this…???