This may be a really simple problem, my ajax.request only works if I click the button that has the onclick="Ajax.Updater Function". Whenever I try to submit the form using the return key it processes it as a non-ajax request. Is there anyway that I can submit my form by both clicking on the button and hitting the "return" key? Thank you! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Chris, Can you give us a bit more to go on? Maybe post a minimal test case to http://pastie.org? Tell us what browsers you''re seeing this on and what browsers you plan to support? My first reaction, without knowing the above, is that onclick is a mouse event and so it''s not a surprise that the keyboard equivalent doesn''t go through it (it''s disappointing, but not _surprising_). If this is a form and the button in question is a submit button, I''d tend to think using the "onsubmit" of the form instead would solve the problem (just be sure to return false so it doesn''t get submitted twice). Otherwise, there are ways to hook keyboard events and do this, but it''s more hassle. FWIW. -- T.J. Crowder tj / crowder software / com On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote:> This may be a really simple problem, my ajax.request only works if I > click the button that has the onclick="Ajax.Updater Function". > Whenever I try to submit the form using the return key it processes it > as a non-ajax request. Is there anyway that I can submit my form by > both clicking on the button and hitting the "return" key? > Thank you!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi TJ, Here is a link to simple prototype todo list app http://chrispurcell.net/blog/demo/todo/. It works fine if you click the "Add" button but when trying to submit the form with the return key it treats it like a normal form submit. I did try the onsubmit and had no luck. Thanks! --Chris On Jun 13, 12:23 am, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey Chris, > > Can you give us a bit more to go on? Maybe post a minimal test case > tohttp://pastie.org? Tell us what browsers you''re seeing this on and > what browsers you plan to support? > > My first reaction, without knowing the above, is that onclick is a > mouse event and so it''s not a surprise that the keyboard equivalent > doesn''t go through it (it''s disappointing, but not _surprising_). If > this is a form and the button in question is a submit button, I''d tend > to think using the "onsubmit" of the form instead would solve the > problem (just be sure to return false so it doesn''t get submitted > twice). Otherwise, there are ways to hook keyboard events and do > this, but it''s more hassle. > > FWIW. > -- > T.J. Crowder > tj / crowder software / com > > On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > This may be a really simple problem, my ajax.request only works if I > > click the button that has the onclick="Ajax.Updater Function". > > Whenever I try to submit the form using the return key it processes it > > as a non-ajax request. Is there anyway that I can submit my form by > > both clicking on the button and hitting the "return" key? > > Thank you!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
move the onclick code back to onsubmit and change the button to input type=submit On Fri, Jun 13, 2008 at 9:13 PM, Chris <haroldthehungry-ee4meeAH724@public.gmane.org> wrote:> > Hi TJ, > Here is a link to simple prototype todo list app > http://chrispurcell.net/blog/demo/todo/. > It works fine if you click the "Add" button but when trying to submit > the form with the return key it treats it like a normal form submit. > I did try the onsubmit and had no luck. > Thanks! > --Chris > > On Jun 13, 12:23 am, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hey Chris, > > > > Can you give us a bit more to go on? Maybe post a minimal test case > > tohttp://pastie.org? Tell us what browsers you''re seeing this on and > > what browsers you plan to support? > > > > My first reaction, without knowing the above, is that onclick is a > > mouse event and so it''s not a surprise that the keyboard equivalent > > doesn''t go through it (it''s disappointing, but not _surprising_). If > > this is a form and the button in question is a submit button, I''d tend > > to think using the "onsubmit" of the form instead would solve the > > problem (just be sure to return false so it doesn''t get submitted > > twice). Otherwise, there are ways to hook keyboard events and do > > this, but it''s more hassle. > > > > FWIW. > > -- > > T.J. Crowder > > tj / crowder software / com > > > > On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > > > This may be a really simple problem, my ajax.request only works if I > > > click the button that has the onclick="Ajax.Updater Function". > > > Whenever I try to submit the form using the return key it processes it > > > as a non-ajax request. Is there anyway that I can submit my form by > > > both clicking on the button and hitting the "return" key? > > > Thank you! > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Brian, I gave that a try, didn''t seem to work. Thanks for the suggestion, any other thoughts? --Chris On Jun 13, 7:51 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> move the onclick code back to onsubmit and change the button to input > type=submit > > On Fri, Jun 13, 2008 at 9:13 PM, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > Hi TJ, > > Here is a link to simple prototype todo list app > >http://chrispurcell.net/blog/demo/todo/. > > It works fine if you click the "Add" button but when trying to submit > > the form with the return key it treats it like a normal form submit. > > I did try the onsubmit and had no luck. > > Thanks! > > --Chris > > > On Jun 13, 12:23 am, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey Chris, > > > > Can you give us a bit more to go on? Maybe post a minimal test case > > > tohttp://pastie.org?Tell us what browsers you''re seeing this on and > > > what browsers you plan to support? > > > > My first reaction, without knowing the above, is that onclick is a > > > mouse event and so it''s not a surprise that the keyboard equivalent > > > doesn''t go through it (it''s disappointing, but not _surprising_). If > > > this is a form and the button in question is a submit button, I''d tend > > > to think using the "onsubmit" of the form instead would solve the > > > problem (just be sure to return false so it doesn''t get submitted > > > twice). Otherwise, there are ways to hook keyboard events and do > > > this, but it''s more hassle. > > > > FWIW. > > > -- > > > T.J. Crowder > > > tj / crowder software / com > > > > On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > > > This may be a really simple problem, my ajax.request only works if I > > > > click the button that has the onclick="Ajax.Updater Function". > > > > Whenever I try to submit the form using the return key it processes it > > > > as a non-ajax request. Is there anyway that I can submit my form by > > > > both clicking on the button and hitting the "return" key? > > > > Thank you!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Also, make sure that the onsubmit action returns a false so that the actual form action is not called for. /Anders 14 jun 2008 kl. 04.51 skrev Brian Williams:> move the onclick code back to onsubmit and change the button to > input type=submit > > > On Fri, Jun 13, 2008 at 9:13 PM, Chris <haroldthehungry-ee4meeAH724@public.gmane.org> > wrote: > > Hi TJ, > Here is a link to simple prototype todo list app http://chrispurcell.net/blog/demo/todo/ > . > It works fine if you click the "Add" button but when trying to submit > the form with the return key it treats it like a normal form submit. > I did try the onsubmit and had no luck. > Thanks! > --Chris > > On Jun 13, 12:23 am, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hey Chris, > > > > Can you give us a bit more to go on? Maybe post a minimal test case > > tohttp://pastie.org? Tell us what browsers you''re seeing this on and > > what browsers you plan to support? > > > > My first reaction, without knowing the above, is that onclick is a > > mouse event and so it''s not a surprise that the keyboard equivalent > > doesn''t go through it (it''s disappointing, but not _surprising_). > If > > this is a form and the button in question is a submit button, I''d > tend > > to think using the "onsubmit" of the form instead would solve the > > problem (just be sure to return false so it doesn''t get submitted > > twice). Otherwise, there are ways to hook keyboard events and do > > this, but it''s more hassle. > > > > FWIW. > > -- > > T.J. Crowder > > tj / crowder software / com > > > > On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > > > This may be a really simple problem, my ajax.request only works > if I > > > click the button that has the onclick="Ajax.Updater Function". > > > Whenever I try to submit the form using the return key it > processes it > > > as a non-ajax request. Is there anyway that I can submit my > form by > > > both clicking on the button and hitting the "return" key? > > > Thank you! > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Chris,> I did try the onsubmit and had no luck.Again, specifics are useful -- no luck *how*? It works fine for me on FF2, IE6, Op9, and Safari3 on Windows XP: http://pastie.org/214947 This example just shows the result of the post in a div via Ajax.Updater, but you can use Ajax.Request if it''s more appropriate to your needs. The JSP used in this example just writes out "<p>You sent ''<%=request.getParameter("testField")%>''</p>" Items of note: * Give the form an ID to make it easy to retrieve via $(). * Hook up the event via Element.observe(). * Stop the event in the submit handler via evt.stop(). Hope this helps, -- T.J. Crowder tj / crowder software / com On Jun 14, 2:13 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote:> Hi TJ, > Here is a link to simple prototype todo list apphttp://chrispurcell.net/blog/demo/todo/. > It works fine if you click the "Add" button but when trying to submit > the form with the return key it treats it like a normal form submit. > I did try the onsubmit and had no luck. > Thanks! > --Chris > > On Jun 13, 12:23 am, "T.J. Crowder" <tjcrow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey Chris, > > > Can you give us a bit more to go on? Maybe post a minimal test case > > tohttp://pastie.org? Tell us what browsers you''re seeing this on and > > what browsers you plan to support? > > > My first reaction, without knowing the above, is that onclick is a > > mouse event and so it''s not a surprise that the keyboard equivalent > > doesn''t go through it (it''s disappointing, but not _surprising_). If > > this is a form and the button in question is a submit button, I''d tend > > to think using the "onsubmit" of the form instead would solve the > > problem (just be sure to return false so it doesn''t get submitted > > twice). Otherwise, there are ways to hook keyboard events and do > > this, but it''s more hassle. > > > FWIW. > > -- > > T.J. Crowder > > tj / crowder software / com > > > On Jun 13, 5:33 am, Chris <haroldthehun...-ee4meeAH724@public.gmane.org> wrote: > > > > This may be a really simple problem, my ajax.request only works if I > > > click the button that has the onclick="Ajax.Updater Function". > > > Whenever I try to submit the form using the return key it processes it > > > as a non-ajax request. Is there anyway that I can submit my form by > > > both clicking on the button and hitting the "return" key? > > > Thank you!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---