Forum Moderators: open
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.
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!