Posted By

bordalix on 06/20/07


Tagged

table checkbox columns


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


checkbox with associated values checked in a 3 columns table


 / Published in: Rails
 

  1. <p>Companies:<br/>
  2. <table class="tbl">
  3. <% cells = 0 %>
  4. <% Company.find(:all).each do |c| %>
  5. <% cells += 1 %>
  6. <% if cells.divmod(3)[1] == 1 -%><tr><% end -%>
  7. <td><input type="checkbox" name="technology[company_ids][]" value="<%= c.id -%>"
  8. <% if @technology.companies.include?(c) -%> checked="checked" <% end -%> />
  9. <%= c.name %></td>
  10. <% if cells.divmod(3)[1] == 0 -%></tr><% end -%>
  11. <% end %>
  12. </table>
  13. </p>

Report this snippet  

You need to login to post a comment.