I am working with rails 3.0. In my opinion, I am trying to have a table with a check box for each row and an onclick event function with specific parameters, which are the 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 have not achieved this. I know that the variable joueurs.gch not empty and there is a beacaus, I use it elsewhere in my view.
I want to create 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>
source share