Question

<% @divisions.each do |division| %>
  <td class="user_radio"><%= radio_button_tag("division_ids[]", division.id, false, :onClick=> 'redirect_to edit_division_path(division)')%></td>
  /* rest of the elements in the division */
  <% end %>

I need that on clicking the radio button the page gets redirected to the edit_division_path for the division being clicked.

But nothing happens. No error or anything else..

What am I doing wrong?

I am using rails 3..

Était-ce utile?

La solution

onClick is a javascript thing.

What you want is something like this:

:onClick => 'location.href="' + edit_division_path(division) + '"'

Autres conseils

onclick = "document.location.href='somepage.htm'"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top