BigSmoke
2006-May-09 11:11 UTC
[Rails] [Prototype] Why doesn''t calling submit() on a form result in the execution of the onsubmit event handler?
Hi, Is it normal that a call to $(''some_form'').submit() doesn''t result in the execution of an onsubmit event handler on ''some_form''? Thanks, - Rowan -- Morality is usually taught by the immoral. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060509/685db992/attachment.html
Jonathan Viney
2006-May-09 12:14 UTC
[Rails] [Prototype] Why doesn''t calling submit() on a form result in the execution of the onsubmit event handler?
It''s just how forms work. The equivalent of clicking the submit buttons is something more like: if ($(''my_form'').onsubmit()) $(''my_form'').submit(); When submitting a form with Ajax, onsubmit serializes the form, initiates the remote request and returns false. submit() is never run. -Jonathan. On 5/9/06, BigSmoke <bigsmoke@gmail.com> wrote:> Hi, > > Is it normal that a call to $(''some_form'').submit() doesn''t result in the > execution of an onsubmit event handler on ''some_form''? > > Thanks, > > - Rowan > > -- > Morality is usually taught by the immoral.
BigSmoke
2006-May-09 14:40 UTC
[Rails] [Prototype] Why doesn''t calling submit() on a form result in the execution of the onsubmit event handler?
I should have (but hadn''t) realized that I could simply run $(''my_form'').unsubmit() myself. Thanks for kindly pointing me where I should have looked in the first place :-) - Rowan On 5/9/06, Jonathan Viney <jonathan.viney@gmail.com> wrote:> > It''s just how forms work. The equivalent of clicking the submit > buttons is something more like: > > if ($(''my_form'').onsubmit()) $(''my_form'').submit(); > > When submitting a form with Ajax, onsubmit serializes the form, > initiates the remote request and returns false. submit() is never run. > > -Jonathan. > > On 5/9/06, BigSmoke <bigsmoke@gmail.com> wrote: > > Hi, > > > > Is it normal that a call to $(''some_form'').submit() doesn''t result in > the > > execution of an onsubmit event handler on ''some_form''? > > > > Thanks, > > > > - Rowan >-- Morality is usually taught by the immoral. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060509/c8f35437/attachment-0001.html