O
Oleg Konovalov
Hi,
I have a Java/JavaScript GUI application where I perform a lot of long DB
operations
[e.g. massive SQL Insert's], which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and clicks
again,
which created duplicate forcm submission and hence duplicate records.
So I am trying to disable the button as soon as it is clicked, and as soon
as it's done,
re-enable it again.
I tried to do it in Javascript, just simple: <input... name=Save...
onclick="enabled=true;">
and as soon as screen refreshes, it re-enables the button automatically.
That works in some cases, however when I need to do some other Javascript
operation
(e.g. validate the fields on the screen), disabling the button automatically
stops both Javascript
and associated form action in Java which is totally unacceptable.
Is there any other simple solution to such problems in Java or Javascript ?
Maybe AJAX ?
Any help is very appreciate. Please provide a code sample or a pointer to
the resources.
Thank you in advance,
Oleg.
P.S.: It probably doesn't matter much, but that is a Cocoon2.0/XSLT app
with Actions in Java [servlet based], using JDK1.4.2 and IE6.
I have a Java/JavaScript GUI application where I perform a lot of long DB
operations
[e.g. massive SQL Insert's], which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and clicks
again,
which created duplicate forcm submission and hence duplicate records.
So I am trying to disable the button as soon as it is clicked, and as soon
as it's done,
re-enable it again.
I tried to do it in Javascript, just simple: <input... name=Save...
onclick="enabled=true;">
and as soon as screen refreshes, it re-enables the button automatically.
That works in some cases, however when I need to do some other Javascript
operation
(e.g. validate the fields on the screen), disabling the button automatically
stops both Javascript
and associated form action in Java which is totally unacceptable.
Is there any other simple solution to such problems in Java or Javascript ?
Maybe AJAX ?
Any help is very appreciate. Please provide a code sample or a pointer to
the resources.
Thank you in advance,
Oleg.
P.S.: It probably doesn't matter much, but that is a Cocoon2.0/XSLT app
with Actions in Java [servlet based], using JDK1.4.2 and IE6.