radiobox collection in a 3 column table


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <p>Contact:<br/>
  2. <table class="tbl">
  3. <% cells = 0 %>
  4. <% Contact.find(:all).each do |c| %>
  5. <% cells += 1 %>
  6. <% if cells.divmod(3)[1] == 1 -%><tr><% end -%>
  7. <td><input type="radio" name="task[contact_id]" value="<%= c.id -%>"
  8. <% if @task.contact == 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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.