select within loop in Rails 3, taking only first option -
select within loop in Rails 3, taking only first option -
guys have form this
<%= form_tag({:action => 'update_survey_list_status') do%> <table id="survey_form"> <tr> <th>beneficiary details</th> <th>hfi details</th> <th style="vertical-align: middle"> <input type='checkbox' name='checkall' onclick='checkedall();'></th> </tr> <% @to_be_registred_list.each |b| %> <tr> <td style="vertical-align: middle"><b> <%= b.name %></b><br /> <span><%= b.age %>, <%= b.sex %><br /><%= b.address %></span> </td> <td style="vertical-align: middle"> <%= select("beneficiaryloans","hfi_id", beneficiary.find(b.beneficiary_id).beneficiaryloans.collect { |h| [user.find(h.hfi_id).name+" - rs. #{h.amount} @ #{h.rate} % #{h.period}", h.hfi_id] }) %> </td> <td> <%= check_box_tag "benificiary_loan_ids[]", b.beneficiary_id,:name => "benificiary_loan_ids[]"%> </td> </tr> <% end %> </table> <%end %>
here, within form, @to_be_registred_list homecoming 2 records, each |b| record, within select tag
beneficiary.find(b.beneficiary_id).beneficiaryloans.collect homecoming many records. each drop-down filled associated values. here if submits form, after selecting different records each drop-down, takes first alternative each drop-down. how solve this?
i need selected form each drop-down!
did used debug on rails? utilize , check params you're receiving
ruby-on-rails ruby-on-rails-3 forms drop-down-menu html-select
Comments
Post a Comment