I have the following rails form (which works) but I want to remove the submit_tag and have the form submit as soon as a radio button selection is made. How do I do that?
<
So I have found the precise solution (thanks for the input guys, it helped me redefine my Google searches). Everyone was on the right track, but none were spot on.
All that was needed was to add 'false, :onclick => "this.parentNode.submit();"' to the radio_button_tag form helper. The false is selected or not, and the rest is obvious.
The correct solution now looks like:
<% form_tag({ :controller => "votes", :action => "create", :id => @item.id } ) do %>
<% for i in 1..10 do %>
<%= radio_button_tag :rating, i, false, :onclick => "this.parentNode.submit();" %> <%=h i %>
<% end %>
<% end %>