Dynamic input form in rails -


i trying add rows of input forms partial. of fields in partial have collection_select:

<td><%= label_tag :book_id, t("book") %></td> <td><%= collection_select :books, "books[:id]", book.all, :id, :name %></td> 

the problem when dynamically add rows of kind last 1 passed controller in params. did not pass collection partial because dynamically added. appreciate if can me out one.

its because param name being replaced clones. can add counter:

<% (1..10).each |i| %>   <td><%= collection_select :books, "books[#{i}][:id]", book.all, :id, :name %></td> <% end %> 

of course, simple example. better control counter javascript events.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -