I have 2 form, I want to create in my one form check_box_tag and if I checked same item, this item put in another form in hiden field tag, and when I save my another form value this item save in my database.
in my view
<% for item in @items %>
<%= check_box_tag "items[#{item.id}]", item.id, :name => "items[]" %>
<% end %>
<% form_for(@feedback ) do |f| %>
<%= f.hidden_field :item_value %> #this is field in which I want put from one form
<%= f.label :name, "Name" %></td>
<%= f.text_field :name, :style => "width:100%" %>
<%= f.label :phone, "Phone" %>
<%= f.text_field :phone, :style => "width:100%" %>
<%= f.label :email, "Email" %>
<%= f.text_field :email, :style => "width:100%" %>
<%= f.submit "Submit" %>
<% end %>
in my controller
...
@item = Item.find(:all)
@feedback = Feedback.new(params[:feedback])
email = ApplicationMailer.create_feedback_rez(@feedback)
email.set_content_type("text/html; charset=utf-8")
ApplicationMailer.deliver(email)
@feedback.save
...
How can I do it?
Thanks for advice!