Wes Gamble
2008-Nov-03 20:39 UTC
Disabling observe_form AJAX request on submit button click?
All, I have a form that is using observe_form to periodically check for modifications to the form and submit an AJAX request. It works really well. However, by watching Firebug output, I notice that the AJAX request always fires when I click the submit button, and even when nothing has changed on the form. Is there any way to suppress the firing of this AJAX request when the submit button on the form is clicked? Thanks, Wes -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2008-Nov-03 20:49 UTC
Re: Disabling observe_form AJAX request on submit button click?
Hijacking the click handler by adding this: :onclick => ''this.form.submit(); return false'' to the submit_tag() call for the submit button seems to work well. Wes -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
tonypm
2008-Nov-05 06:55 UTC
Re: Disabling observe_form AJAX request on submit button click?
I had a similar thing with a form whithout a submit button. I wanted to use form observer. The form only had select fields (and an autocomplete field). If I hit enter, the form gets submitted, even if the cursor is in the autocomplete field. Never did quite figure it out but got round it by using field observers instead. It seemed like the focus iinternally in the form was in a virtual submit button. If I add a normal text field, the problem goes away. Tonypm --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---