hey,
i have this problem
how come i always get -1 for the select list??
rhtml
First, select a client.
<%= options_for_select(@client_options, @client_id.to_i) %>
<%= @client_id %>
controller
if @request.post?
if @request.xml_http_request? #called by ajax,
@client_id = -2
else
@client_id = -11#params[:client][:id].nil? ? -11 :
params[:client][:id]
end
else
@client_id = -1
end
shouldnt it be-11 ???
Output
First, select a client.
Select a client
Twodecode
-1
Hi Nick
I’d use the script\breakpointer to check what’s happening here (put a
breakpoint instruction just above the line you want to check, and launch
the
breakpointer: you’ll be able to quickly inspect the variables and know
exactly what happens).
Thibaut
hmmm, doesnt seem to work
i cant find the problem, i made a lot a forms with ruby now, and this
one cant i
get to work :s:s
cant seem to get the value of [:client][:id] , it is always -1
when i do inspect
<%= params.inspect %>
{“action”=>“access_geotags”, “id”=>“32”, “controller”=>“users”}
and in the rhtml
<%= check_box "user", "view_all_geotags" %> User may
view all
geotags from the selected clients. |
Or, select the geotags the user can view. |
First, select a client.
<%= @client_id.inspect %>
<%= options_for_select(@client_options, @client_id.to_i) %>
|
output of rhtml
User may view all geotags from the selected clients. |
Or, select the geotags the user can view. |
First, select a client.
3
Select a client
Belcompany
BYS
Twodecode
|
in the controller
if @request.post?
@client_id = params[:client][:id].blank? ? -1 : params[:client][:id]
else
@client_id = 3
end
if @request.post?
@user_id = params[:id]
@geotagidlist = params[:selected_geotagtype].blank? ? -1 :
params[:selected_geotagtype]
@user.update_attribute(:view_all_geotags,
params[:user][:view_all_geotags] )
end
the update works but i cant get the clientid :s:s:s