ruby on rails - Passing variable param in form via dropdown -
i have form:
<tr> <% item.inventory_items.each |product| %> <td> <%= form_tag("/list_items", method: "post") %> <%= hidden_field_tag(:item_id, item.id) %> <%= hidden_field_tag(:inventory_item_id, product.id) %> <%= hidden_field_tag(:shopping_list_id, shoppinglist.first.id) %> <%= submit_tag("#{product.price}", class: "btn btn-primary") %> <% end %> </td> <% end %> </tr>
currently hidden_field shopping_list_id
being set, can see, shoppinglist.first.id
. placeholder make sure form working. want :user
able select of lists submit list_item
to. i'm unsure of best way that. ideally i'd able have them hover on product price , have drop down of lists select from, whereby form shopping_list_id
from. how can best accomplish this? i'm using twitter bootstrap. in advance.
something should started:
<%= select_tag(@user, :shopping_list_id, options_for_select(@user.lists)) %>
Comments
Post a Comment