Tom,

You can also put JavaScript code in the form's onSubmit event code to
disable all the elements in the form.  To make sure this happens after
submission (otherwise nothing gets submitted) use window.setTimeout() to run
the disable script after a short delay.

Another alternative is to put a unique token in a hidden field.  The server
keeps track of these tokens: once one is "spent" by submitting the form it
can't be reused.  This is more bulletproof but needs more coding (though I
expect you could use a filter to localize it).

Chris


-----Original Message-----
From: Bill Lunnon [mailto:[EMAIL PROTECTED]
Sent: 27 October 2003 23:26
To: Tomcat Users List
Subject: RE: Form Double Submit Detection


Tom,
Don't know if this is complimentary to your workflow,
try a javascript confirm (ie a client side pop-up, asking the user to click
"Ok" to continue). This will catch any double clicks on the client side.

Hope this helps

Bill

-----Original Message-----
From: Tom Parker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 28 October 2003 10:18 AM
To: [EMAIL PROTECTED]
Subject: Form Double Submit Detection


I've designed my workflows so that they do not need to store anything in
the user's session. This allows the user to conduct more than one
instance of a particular task at the same time without data getting
mixed up. However this presents me with a problem if the user double
clicks the submit button and causes the server to do something twice.

The normal(?) way of detecting this would be to store a unique token in
the session and in the form, and compare them to ensure that the user
has not submitted this form twice. For this to work, you need to store
something in the session for each possible form submission. If the user
never submits the form, then the token will hang around for the life of
the session as we don't know that the user won't submit the form
someday.

Currently I'm thinking of allowing the user to store a finite number of
duplicate check tokens, or to make the tokens expire after an amount of
time. The former doesn't seem very attractive (load a record, view a
bunch of other records such that the first record's token is dropped,
save the first record - no token found), while the latter could lead to
rather a lot of tokens being stored.

Is there a solution to this problem that I'm missing?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


The information in this e:mail and any attachments or any 
reproduction of this e:mail in whatever manner is confidential 
and for the use of the addressee(s) only.  If you are not the 
addressee then the distribution, use or reproduction of this 
e:mail or the information within it is strictly prohibited and 
may be unlawful.  If received in error please advise the 
sender and delete all record of it from your system.  
Although believed to be virus free, accurate and complete,  
responsibility for any loss or cost arising from its receipt or 
use or its incomplete or inaccurate transmission is hereby 
excluded to the fullest extent possible.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to