i have drop down menu populate values database in following way.
select(:user, i, user.all.where(:role => 'member').collect {|u| [u.email, u.id]})
i variable keep incrementing in loop. iterate through list , each row has drop down box. (i use variable i, generate unique id each select box).
for each row have link called checkout. on clicking checkout want pop box (data-confirm), whether want proceed checkout selected user drop down menu. if user presses yes, has go link specify. not able value of selected dropdown menu. think due mixing of javascript within ruby isnt idea. best way proceed this?
my checkout link in following way:
<%= link_to "checkout",book ,data: { confirm:{'are sure'}} %>
i know how value of selected drop down menu using javascript, not able find way modify values in link_to field. (i using rails 4.2.4)
i'm having tough time interpreting question, instead of select field , link, think might want make form so:
<%= form_tag book_path %> <%= select_tag "user", options_for_select(user.where(role: 'member').collect{ |u| [u.email, u.id] }), id: %> <%= submit_tag 'checkout', confirm: 'are sure?' <% end %>
i'm not sure loop at, you'll have adjust code probably, that's gist of want think.
Comments
Post a Comment