views:

376

answers:

1

I have the following form:

<% form_for(:tag, :url => {:action => "post_tag", :id => @photoID}) do |form| %>
  <%= error_messages_for(:tag) %>
  <% if @errors then %>
  <%= @errors[0] %>
  <% end %>
  <p><%= form.select(:user_id, @userHash) %></p>
  <p><%= form.hidden_field(:xpos) %></p>
  <p><%= form.hidden_field(:ypos) %></p>
  <p><%= form.hidden_field(:width) %></p>
  <p><%= form.hidden_field(:height) %></p>
  <%= submit_tag "Submit Tag" %>
<% end %>

But none of the values are filled in the controller. I know the values are all full in the view because I can see they have the correct values in Firebug. In the controller, I am trying to access them like params[:xpos] for the :xpos hidden_field. Is this correct???

+1  A: 

Do logger.debug params.inspect. I have a sneaking suspicion you will see params[:tag][:xpos] there :)

You have passed a name to form tag there (form_for(:tag, ...) do |form|), it will wrap all fields constructed as form.field(...) in a hash identified by the passed name ("tag", in this case).

Toms Mikoss
you are absolutely right :)
hatorade