I’m working with rails 3.0.
In my view, I’m trying to have a table with a check box for each row, and an onclick event function with specific parameters wich are rails variable
<table>
<% @joueurs.each do |joueur| %>
<tr>
<td>
<%= check_box_tag(joueur.id,joueur.id, false, :onclick=>"addPlayerToField(<%= joueur.gch %>,<%= joueur.drt %>);")%>
</td>
...
</tr>
<% end %>
</table>
I try many ways and I did not achieve to do it. I know the joueurs.gch variable is not empty and exist beacaus I use it elsewhere in my view.
I want to generate something like :
<table>
<tr>
<td>
<input id="2036" name="2036" onclick="addPlayerToField(12, 13);" type="checkbox" value="2036"/>
</td>
</tr>
<tr>
<td>
<input id="2037" name="2037" onclick="addPlayerToField(22, 10);" type="checkbox" value="2036"/>
</td>
</tr>
</table>
I think you probably want something like this: