Page 1 of 1
goodle chrom alway submit when i enter keycode = 13
Posted: Tue Apr 14, 2009 11:43 pm
by nv_thien
hi, anybody help me
i'm using JQuery.
i made a jquery dialog. then enter value on the Form. i have a function to validate data. but when i press key "Enter", it allway submit form to server. in IE and FF, it works fine
Thanks and best regards
Thien
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 10:09 am
by pickle
It's not a standard at all to submit a form when the user hits enter - that's a browser-by-browser specific behaviour. If you want it to always happen, you'll have to listen to the field for keycode 13 - enter.
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 10:11 am
by php_east
i know next to nothing about jquery, but for the form, supress the submit by using your own onsubmit().
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 11:55 am
by kaszu
@pickle Form submits on enter key press in all browsers if focus is on input and in form exists submit button.
I had similar issue with safari, problem was a typo. Check if your html is valid..
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 12:12 pm
by pickle
kaszu wrote:@pickle Form submits on enter key press in all browsers if focus is on input and in form exists submit button.
That may be so, for all current browsers, but there's no guarantee the user the user has one of those browsers, or that all browsers will continue to provide this functionality in the future. My point was that just because it doesn't happen in a particular browser doesn't
necessarily mean he's done something wrong.
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 5:02 pm
by php_east
pickle wrote:That may be so, for all current browsers, but there's no guarantee the user the user has one of those browsers, or that all browsers will continue to provide this functionality in the future.
what ??? enter key is not guranteed to work ? has w3c gone mad ? it's absurd.
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 5:20 pm
by pickle
I'm certainly not a w3c guru, but I've seen no specification that says a form must be submitted when enter is pressed. As ~kaszu stated, all current browsers do this, but that's simply for ease-of-use, not to meet any specification.
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Wed Apr 15, 2009 6:01 pm
by Benjamin
I'm actually looking for a way to PREVENT the enter key from submitting the form in a spare time project. I'm going to try to capture the keypress and make sure it does nothing.
Re: goodle chrom alway submit when i enter keycode = 13
Posted: Thu Apr 16, 2009 7:36 pm
by php_east
pickle wrote:I'm certainly not a w3c guru, but I've seen no specification that says a form must be submitted when enter is pressed. As ~kaszu stated, all current browsers do this, but that's simply for ease-of-use, not to meet any specification.
well, yes, w3c doesn't exactly say use enter key. what i meant was that when it was said something like "browsers should submit form", it is translated in a normal way to mean when you pressed enter or click on the equivalent. it is a shortcut widely used by very many people. as is the tab key. in windows environment. i dunno, maybe i am missing something. but if browsers stop responding to enter key i'm sure many will have problems. that's all i'm saying.