Hi there, I need to have a checkbox which ajax-submits a form. The following code throws an error "index 112009 out of string". What''s wrong here? =============================================<% form_remote_tag :url => { whatever_url } do -%> <%= check_box_tag ''whatever'', nil, whatever, { :onclick => "#{remote_function(''this.form.submit();'')}", :disabled => false } %> <% end -%> ============================================= Thanks for any help with this! Tom -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
anton effendi
2010-Mar-09 18:04 UTC
Re: Ajax-submit form on "check box onclick ": why this error?
I think... Dont use #{....} <%= check_box_tag ''whatever'', nil, whatever, { :onclick => "remote_function(''this.form.> > submit();'')", :disabled => false } %> >But I dont because i never try it... keep trying On Wed, Mar 10, 2010 at 1:02 AM, Tom Ha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi there, > > I need to have a checkbox which ajax-submits a form. > > The following code throws an error "index 112009 out of string". What''s > wrong here? > > =============================================> <% form_remote_tag :url => { whatever_url } do -%> > > <%= check_box_tag ''whatever'', nil, whatever, { :onclick => > "#{remote_function(''this.form.submit();'')}", :disabled => false } %> > > <% end -%> > =============================================> > Thanks for any help with this! > Tom > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Senior Rails Developer Anton Effendi - Wu You Duan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Ha
2010-Mar-09 18:14 UTC
Re: Ajax-submit form on "check box onclick ": why this error?
Thanks for your answer. Unfortunately, if I try... :onclick => "remote_function(''this.form.submit();'')" ...then I get an error (by Firebug): "remote_function is not defined" Any other ideas? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Ha
2010-Mar-10 08:48 UTC
Re: Ajax-submit form on "check box onclick ": why this error?
Anyone...? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-10 09:39 UTC
Re: Re: Ajax-submit form on "check box onclick ": why this error?
On 9 March 2010 18:14, Tom Ha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thanks for your answer. Unfortunately, if I try... > > :onclick => "remote_function(''this.form.submit();'')" > > ...then I get an error (by Firebug): "remote_function is not defined"What method called remote_function are you trying to call? Can you point me to the docs for it? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Ha
2010-Mar-10 11:10 UTC
Re: Re: Ajax-submit form on "check box onclick ": why this error?
Hi Colin, it''s this one here: http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001653 (in order to ajax-submit a form using form_remote_tag, see code above...) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-10 11:57 UTC
Re: Re: Re: Ajax-submit form on "check box onclick ": why this error?
On 10 March 2010 11:10, Tom Ha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi Colin, > > it''s this one here: > > http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001653Your code does not seem to be much like the example given, either in the way it is invoked or in the parameter. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tom Ha
2010-Mar-10 12:08 UTC
Re: Re: Re: Ajax-submit form on "check box onclick ": why this error?
Any idea how the code would have to be, in order to achieve my goal? (see 1st post) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-10 12:12 UTC
Re: Re: Re: Re: Ajax-submit form on "check box onclick ": why this error?
On 10 March 2010 12:08, Tom Ha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Any idea how the code would have to be, in order to achieve my goal? > (see 1st post)No, sorry, I have never done this. Anyone else? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Tom, I came across your post looking for a solution myself. This is what''s working for me: <% form_remote_tag :url => { whatever_url } do -%> <%= check_box_tag ''whatever'', nil, whatever, { :onclick => "this.form.submit();", :disabled => false } %> <% end -%> Hope that helps, Cheers, roark Tom Ha wrote:> Hi there, > > I need to have a checkbox which ajax-submits a form. > > The following code throws an error "index 112009 out of string". What''s > wrong here? > > =============================================> <% form_remote_tag :url => { whatever_url } do -%> > > <%= check_box_tag ''whatever'', nil, whatever, { :onclick => > "#{remote_function(''this.form.submit();'')}", :disabled => false } %> > > <% end -%> > =============================================> > Thanks for any help with this! > Tom-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.