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 <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
