This doesn''t work unfortunately. I''d be willing to bet it''s the form.submit() call conflicting with ajax. Any suggestions on how to remedy this? <%= form_remote_tag(:url => { :action => :rate }, :update => "rating") %> <%= hidden_field_tag("bit_id", @bit.id) %> <%= (1..10).map {|i| "<input type=''radio'' name=''rating'' onclick=''this.form.submit()'' value=''#{i}''/>#{i}"} %> <%= end_form_tag %> Thanks, PJ
form.submit() usually bypasses the onsubmit action (which is where the remote AJAX is placed). Why not change this.form.submit() to this.form.onsubmit() and see what happens. Wayne -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of PJ Hyett Sent: Sunday, 26 June 2005 6:50 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] Ajax form submit This doesn''t work unfortunately. I''d be willing to bet it''s the form.submit() call conflicting with ajax. Any suggestions on how to remedy this? <%= form_remote_tag(:url => { :action => :rate }, :update => "rating") %> <%= hidden_field_tag("bit_id", @bit.id) %> <%= (1..10).map {|i| "<input type=''radio'' name=''rating'' onclick=''this.form.submit()'' value=''#{i}''/>#{i}"} %> <%= end_form_tag %> Thanks, PJ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 26-jun-2005, at 10:52, Wayne Robinson wrote:> form.submit() usually bypasses the onsubmit action (which is where the > remote AJAX is placed). > > Why not change this.form.submit() to this.form.onsubmit() and see what > happens.Chech the generated code - it will tell you what goes wrong. -- Julian "Julik" Tarkhanov
Thanks guys, of course it had to be that embarassingly simple. -PJ On 6/26/05, Julian ''Julik'' Tarkhanov <listbox-RY+snkucC20@public.gmane.org> wrote:> > On 26-jun-2005, at 10:52, Wayne Robinson wrote: > > > form.submit() usually bypasses the onsubmit action (which is where the > > remote AJAX is placed). > > > > Why not change this.form.submit() to this.form.onsubmit() and see what > > happens. > > Chech the generated code - it will tell you what goes wrong. > > -- > Julian "Julik" Tarkhanov > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >