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
goodle chrom alway submit when i enter keycode = 13
Moderator: General Moderators
Re: goodle chrom alway submit when i enter keycode = 13
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: goodle chrom alway submit when i enter keycode = 13
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
@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..
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
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.kaszu wrote:@pickle Form submits on enter key press in all browsers if focus is on input and in form exists submit button.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: goodle chrom alway submit when i enter keycode = 13
what ??? enter key is not guranteed to work ? has w3c gone mad ? it's absurd.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.
Re: goodle chrom alway submit when i enter keycode = 13
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: goodle chrom alway submit when i enter keycode = 13
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
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.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.