Forum Moderators: open

Message Too Old, No Replies

how to prevent multiple submits

how to prevent multiple submits

         

ahmetolgun

9:22 am on Jul 22, 2004 (gmt 0)

10+ Year Member



Hi all,

i have a problem related with browser refresh. I have a jsp page that has a form that submits username and pwd to server.

Problem is when i pressed refresh button form is resubmitted and this causes a problem.

How can i prevent resubmission of form or
better how can i be aware that a resubmission is occuring.

rexrhino

12:45 pm on Jul 22, 2004 (gmt 0)

10+ Year Member



I am not familiar with JSP, but I will give you several solutions I would look into:

First, the server-side way:
When I create the form for a user, I would create a random ID number for the instance of that form. When you submit the form, check some sort of record and see if that form has been submited already. This, of course, means that you have to use a database/file/etc. to keep track of the ID numbers, but this is nothing too overwelming.

Second, the client-side way:
Have a javascript onclick event that disables the submit button after you click it, thereby allowing the user to submit only once.

Third:
Do it both ways!