i have a form, which when submitted writes to a database. a few times users have been clicking the submit button twice hence the data has been written back to the database twice.
i have fixed this problem by using the onlick event off the (graphical) submit button by putting a small script that disables the button after it has been clicked.
but . . .
if i hover the mouse cursor over the submit button and hit the enter key continuously i get loads of entries in the database before the form then submits.
any ideas how i can prevent this from happening?.
thanks for your help anyone.
fyi
the forms onSubmit attribute handles validation;
onSubmit="return fnValidateForm(this);"
the forms onClick attribute looks like this;
onClick="btnSubmit(this.form)"
which fires this dinky bit of code;
function btnSubmit(theform)
{
var d = document
d.theform.submit.disabled = true
}
i have fixed this problem by using the onlick event off the (graphical) submit button by putting a small script that disables the button after it has been clicked.
but . . .
if i hover the mouse cursor over the submit button and hit the enter key continuously i get loads of entries in the database before the form then submits.
any ideas how i can prevent this from happening?.
thanks for your help anyone.
fyi
the forms onSubmit attribute handles validation;
onSubmit="return fnValidateForm(this);"
the forms onClick attribute looks like this;
onClick="btnSubmit(this.form)"
which fires this dinky bit of code;
function btnSubmit(theform)
{
var d = document
d.theform.submit.disabled = true
}