I am having an issue where I have multiple forms on a page. The first form has a couple of hidden inputs. The second form has all the visible controls including three buttons. Each of these buttons has a behaviour attached to it (From Ben Nolan''s Behaviour.js) based on its id. The code for the first button is something like this (I am also using prototype.js): var button1Func = function(event) { alert("I am in button1Func"); $(''secondForm'').submit(); }; Behaviour.register( { ''#button1'': function(element) { Event.observe(element, ''click'', button1Func); } }); When the button is clicked, an alert pops up saying "I am in button1Func", but then the status bar says it is calling the action for the first form and not the second. When I move the first form to the bottom of the page, the first button works correctly. What is going on here? It seems to work ok in FF2 and IE7. Thanks, Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Are the forms nested? On Feb 1, 2008 8:53 AM, Rob <rdennett-xF6Zbwfhwd9l57MIdRCFDg@public.gmane.org> wrote:> > I am having an issue where I have multiple forms on a page. The first > form has a couple of hidden inputs. The second form has all the > visible controls including three buttons. Each of these buttons has a > behaviour attached to it (From Ben Nolan''s Behaviour.js) based on its > id. The code for the first button is something like this (I am also > using prototype.js): > > var button1Func = function(event) > { > alert("I am in button1Func"); > $(''secondForm'').submit(); > }; > Behaviour.register( > { > ''#button1'': function(element) > { > Event.observe(element, ''click'', button1Func); > } > }); > > When the button is clicked, an alert pops up saying "I am in > button1Func", but then the status bar says it is calling the action > for the first form and not the second. When I move the first form to > the bottom of the page, the first button works correctly. What is > going on here? It seems to work ok in FF2 and IE7. > > Thanks, > Rob > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jan 31, 2:11 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Are the forms nested? >No. Thanks, Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Do you happen to have a small example of what your html looks like as that is probably a big part of the problem. Greetz, Wizz On Jan 31, 11:13 pm, Rob <rdenn...-xF6Zbwfhwd9l57MIdRCFDg@public.gmane.org> wrote:> On Jan 31, 2:11 pm, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Are the forms nested? > > No. > > Thanks, > Rob--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---