Topic: how to set the value of my checkbox?
hey all,
I'm have a HABTM relationship and I'm trying to use checkbox.
The problem is that I can't set the value of each checkbox
each checkboth value gets set either to 1 or 0 depending on whether the it is checked or not. I would like the value to be equal to the id of my model.
This is how I do it:
<% for cat in @categories %>
<p><b><%= cat.name%></b> <br />
<% for forum in cat.forums %>
<%= check_box(:forums, :id ,:value=>forum.id, :checked => (forum.users.include? @user) ? 'checked' : false ) %><%= forum.forum_name %> <br /><% end %>
</p>
<% end %>
I also tried without the :value=>forum.id but still nothing
Any idea?
thanx in advance
Pat