0

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 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.