Romil,
First off, a warm welcome to the forums.
Your problem certainly is a troublesome one. I think, however, I have the answer.
Slowing things down a bit, lets analyse the situation. Users are pressing enter twice rapidly. The browser will only run the script once after the other, and not at the same time. That means it will run the code, then run it again.
What we could do is after the submission has been activated, we disable the enter key. The script is run, it sees that the enter key has been pressed, it then submits the form, then disables the enter key. When it runs it again, it sees the enter key is disabled, and then does nothing, thus submitting the form once.
We can do this by setting a variable. Its much easier to set variables then it is to disable the key completely (and its also safer). Here is your new code:
Code:
<script language="javascript" type="text/JavaScript"">
var submitBtnObj = document.getElementsByName("saveButton");
document.onkeypress = keyPress;
var count = 1;
function keyPress(d) {
if (count == 1){
key = event.keyCode;
if(key==13) { //For Enter key
submitBtnObj[0].click();
var count=2;
}
}
}
</script>
In
theory it should work, good luck!
Hope this helps,
Beefa