I''ve got an ajaxed form going that is set up to have the user type something in a text field and hit a button that throws that entry into a table on the page. User is expected to enter several items, and then submit the form which goes to the next page. I would like the user to be able to enter an item and hit the return key to toss it into the table, but either Rails or the browser wants to help me out by hooking the return key up to the main submit button. I put in a form_observer in hopes that I could trap the return key in there, but no joy; the submit button "sees it" first and goes on to the next page instead of adding the item. I did a search and all I found was the addition of some javascript to the options for the field tag, like this: :onkeypress => "return event.keyCode != 13 || ($(''add'').click(),false)" Unfortunately this doesn''t seem to work either. Also didn''t work with a ''10'' in there (I''m on a Mac so I thought it might see it as a LF instead). Any help for a robust way to detect the return key before the "submit button sees it"? thanks, jp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---