Dudebot wrote: > I have this code, which is working quite well: > > <% form_tag '', :method => 'GET' do %> > <p><%= radio_button_tag :report, 'by_date', params[ :report ] ||= > 'by_date' %><b>By Date</b></p> > <p><%= radio_button_tag :report, 'by_donor', params[ :report ] == > 'by_donor' %><b>By Donor</b></p> > <p><%= submit_tag "Choose" %><p> > <% end %> > > <%= render( :partial => "orders" , :object => @orders ) %> > (Inside of the _orders partial is where params[ :report ] is > processed) > > But it's ugly in that pressing "Choose" is redundant--I want the > partial action to happen when the user simply selects the radio > button. Is there any way to do this? > > Many TIA, > Craig
The Radio button helper also has an onclick option so you can remote call a function when ever they click the button, or execute some javaScript. I have done this many times in my apps, for exmaple with gender: <% func1 = remote_function( :update => '', :url => { :action => 'gender_female', :id => @user.id}, :with => "'select=' + escape(value)" ) %> <% func2 = remote_function( :update => '', :url => { :action => 'gender_male', :id=> @user.id}, :with => "'select=' + escape(value)" ) %> <span id = "female">Male: <%= radio_button_tag( :gender, :male, @user.gender.to_s == "Male" ? true : false, :onclick => func2 )%></span> <span id = "male">Female: <%= radio_button_tag( :gender, :female, @user.gender.to_s == "Female" ? true : false, :onclick => func1 )%></span> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---