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..

Was it helpful?

Solution

onClick is a javascript thing.

What you want is something like this:

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

OTHER TIPS

onclick = "document.location.href='somepage.htm'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top