Prev: FAQ Topic - How do I check to see if a child window is open, before opening another? (2010-04-20)
Next: FAQ Topic - How do I format a Number as a String with exactly 2 decimal places? (2010-03-30)
From: Sean Kinsey on 21 Apr 2010 02:52 On Apr 21, 8:51 am, Sean Kinsey <okin...(a)gmail.com> wrote: <snip> > Use an event listener on the text fields that returns false on > keyCode===13. That should avoid submitting the form while allowing > enter to be pressed on any other input (including the buttons). And yes I accidentally hit submit before removing the signature so don't even think about it.
From: Garrett Smith on 21 Apr 2010 03:26 Neil wrote: >> By RTFM and not shooting yourself in the foot: >> <form action="..." method="post"> >> <textarea name="myText" cols="30" rows="3"></textarea> >> <input type="submit" name="button" value="Value1" /> >> <input type="submit" name="button" value="Value2" /> >> </form> > > The problem is that I have text inputs on the form > as well and the customer does not want the return key > to submit the form. If I use input type="submit", the > form always gets posted with a return keypress. > Who said the customer is always right? I hate it when sites do that. Trying to reinvent the way an HTML form works is surely going to annoy users who prefer hitting "enter" upon completing a form. For example the user might not want to tab through to the submit button and might really hate using the trackpad. Put the default button first and the form will submit that one when user hits the return key (which is also called the "enter" key on many keyboards). -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on 21 Apr 2010 03:28 Sean Kinsey wrote: > On Apr 21, 8:51 am, Sean Kinsey <okin...(a)gmail.com> wrote: > > <snip> > >> Use an event listener on the text fields that returns false on >> keyCode===13. That should avoid submitting the form while allowing >> enter to be pressed on any other input (including the buttons). > > And yes I accidentally hit submit before removing the signature so > don't even think about it. I was puzzled by this. Then I read your other message and realized what you meant. -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Bwig Zomberi on 21 Apr 2010 03:54 David Mark wrote: > Neil wrote: >>> By RTFM and not shooting yourself in the foot: >>> <form action="..." method="post"> >>> <textarea name="myText" cols="30" rows="3"></textarea> >>> <input type="submit" name="button" value="Value1" /> >>> <input type="submit" name="button" value="Value2" /> >>> </form> >> >> The problem is that I have text inputs on the form >> as well and the customer does not want the return key >> to submit the form. Does not onsubmit="return false" prevent return keypress from submitting the form? > > Then how do they expect keyboard-only users to submit the form? Keyboard-only users will usually use tab to navigate to the submit button and then press the space key. -- Bwig Zomberi
From: Gordon on 21 Apr 2010 04:13
On Apr 21, 2:56 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > Garrett Smith wrote: > > Eric Bednarz wrote: > >> Garrett Smith <dhtmlkitc...(a)gmail.com> writes: > >>>> Are you sure you want to use XHTML? > >>> Probably not; that small sample contains XHTML errors. > > >> Please dont feel shy about being specific. > > > Don't be scared to run the code through the w3c html validator and find > > them for yourself. > > You don't know what you are talking about. It's a fragment of Valid XHTML > 1.0 Transitional. > > PointedEars > -- > var bugRiddenCrashPronePieceOfJunk = ( > navigator.userAgent.indexOf('MSIE 5') != -1 > && navigator.userAgent.indexOf('Mac') != -1 > ) // Plone, register_function.js:16 Form controls can't be children of a form. They have to be contained in something else, a fieldset preferably, but a div will do. |