Event listener for a form being submitted is not catching an A tag
with a submit in it.
Example JS:
$(form).observe(''submit'', function(e) {
e.stop();
// Something
});
Example HTML:
<a href="#" onClick="myForm.submit();">Submit
form</a>
Any idea how to fix this without added more js to button?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Frederick Polgardy
2008-Jun-18 21:02 UTC
Re: Form submit listener not catching form.submit();
Calling aForm.submit() does not get observed by any listeners. Observe will listen to the user generated event - a button or img tag, or pressing return in a text box - but not to a submit() call. Try observing for click and submit and stop/forward to a 3rd function that handles the logic, or have both fire a user event. -Fred On Wed, Jun 18, 2008 at 3:30 PM, louis w <louiswalch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Event listener for a form being submitted is not catching an A tag > with a submit in it. > > Example JS: > $(form).observe(''submit'', function(e) { > e.stop(); > // Something > }); > > > Example HTML: > > <a href="#" onClick="myForm.submit();">Submit form</a> > > Any idea how to fix this without added more js to button?-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- Slider.js - Attemting to put values in form.
- Passing extra parameters to functions called from Observers
- javascript in RoR page - Check ALL/uncheck ALL buttons
- Element.focusFirstElement() causing issue with Element.addMethods()
- Slider.js - Attemting to put values in form.