What i would like to do is when a user clicks an image of a horse that a checkbox is then set to true or false. I have an array of horses and each horse has a checkbox.
The biggest problem I have is setting the ID of my checkbox element. I tried sth like. http://stackoverflow.com/questions/2360465/use-custom-id-for-check-box-tag-in-rails
<% @horses.each do |s| %>
<div class="positionLeft roundedEdge5" style="padding:0 8px;" ondblclick="document.getElementById('line_horses_ids__<%=s.id%>').value = true">
<% if checked == true %>
<%= check_box_tag "line[horses_ids][]", s.id, :checked => true %>
<%= label_tag "line[horses_ids][][#{s.id}]", s.name %>
<% else %>
<%= check_box_tag "line[horses_ids][]", s.id %>
<%= label_tag "line[horses_ids][][#{s.id}]", s.name %>
<% end %>
</div>
<%end%>
But I still cant get the checkbox to change to true? What am i doing wrong? Any help would be appreciated.