Search code examples
formsrails-3.1

redirecting to edit action onclick of a radio button doesnt work


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


Solution

  • onClick is a javascript thing.

    What you want is something like this:

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