In what way did it not work? It could be that your return false is inside an if statement. Mayne you're not making it into that if statement?
-----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 2:58 PM To: jQuery (English) Subject: [jQuery] Re: submitting the form by pressing ENTER Hi, Unfortunately, that didn't work for me. Here was my code: $('#pageForm').submit(function() { var page = $('#page').val(); if (!isInteger(page)) { alert("The page number must be an integer."); return false; } if (!setCurrentPage(page)) { return false; } // if }); I did have success when I did <form id="pageForm" name="pageForm" action="javascript:submitPageForm();"> Damn, hate going back to the old ways. Oh well, - On Mar 25, 1:26 pm, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > You should be able to intercept that button press by using the > submit() method of the form object. > > $('#myForm').submit(function(){ > // this method should fire whether the button was clicked with > the mouse > // or the enter button was pressed > return false; > > }); > > <form id="myForm" action="somepage.cfm"> > <input type="text" name="textField" /> > <input type="submit" value="submit me" /> </form> > > > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of [EMAIL PROTECTED] > Sent: Tuesday, March 25, 2008 12:16 PM > To: jQuery (English) > Subject: [jQuery] submitting the form by pressing ENTER > > Hi, > > I have a form > > <form id="previewForm" name="previewForm"> > > with two buttons and a text field. What I would like is when I press enter > on the text field, a JS function is invoked. What is the JQuery syntax to > trigger this? > > Thanks, - Dave- Hide quoted text - > > - Show quoted text -