hidden fields params

Ok, I'm working dilegently on my question from yesterday and I will post the answer once I get one working... but I'm having problems on an interim stage.

Hidden field basics...I really wrestle getting things in and out of parameters from view to controller so I'm trying this simple approach.

<% for person in @people %> <% [Santa, Elf, Reindeer].each do |holiday_character| %> <div>   <% form_tag :action => :manipulate_based_on_input do %>     If you click the button below this person :     <% image_tag (peron.photo_url) %>       will be tranformed into a<%=h holiday_character %>

     <%= hidden_field( :holder1, :value => person.id )%>

     <%= hidden_field( :holder2, :value => holiday_character ) %>      <% submit_tag "click here" %>     <% end %> </div> <% end %> <% end %>

Ok hopefully I didnt make any typos above because it isnt my exact code thats on a different machine.

That's really unhelpful. If you are going to post code, post exactly what you are using. Often enough, the devil is in the detail. As it is people have to guess whether what looks like a mistake is a mistake or just a typo.

MY problem is that the params from the hidden fields look strange.

If I force an error to look at my params I get something like:

{ "commit"=>"click here", "holder1" =>{"value166"=>""}, "holder1" =>{"valueSanta"=>""} }

Check the docs for hidden_field_tag (I'm assuming that's what you actually meant, rather than what you've remembered). The second parameter is the value, but you're passing :value => foo.

what I want (I think) is more like {. .. , "holder1" => "166", "holder2" => "Santa" }

If I instead use a hidden_ield like:     <%= hidden_field( :holder2, holiday_character ) %> my params look more like {.... , "holder2"=>{"Santa"=>""}, ....}

Can I get a simple params like "holder2"=>"Santa" .??

According to your code above, Santa is a class/module. You want to be passing an actual string to hidden field.

Fred

Meant to add: if you do mean hidden_field, then you need to say hidden_field instance_variable_name, method, :value => 'foo'

Fred