Link to home
Start Free TrialLog in
Avatar of lance22
lance22

asked on

ASP - Prevention of Multiple (re)Submissions

I have a couple forms where people use the "back" button to review their data after submission ... they do this 20 or 30 times producing either data corruption or duplicate records (in SQL2000).  Any ideas on managing this?  I'm using regular ASP, ADO, session objects, and SQL2000 running on a Windows2000 server.

Thanks in advance,

lance22
--------------
Avatar of thomasdodds
thomasdodds

wrap your data insertions with a check for existing data (which unfortunately makes another trip to your db) include a flag in your QueryString to perform the submission processing that way you can control the action ...
ASKER CERTIFIED SOLUTION
Avatar of thomasdodds
thomasdodds

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CRagsdell
Here is a very similar question, with a couple of different ways to deal with your problem:

https://www.experts-exchange.com/questions/20540106/Form-question.html

CR
Another possibility would be to stick a value in the session indicating whether or not the user had already submitted it.  The best way to do this would probably be to store the primary key from the record that was inserted when they submitted it.  Then when they tried to submit it the second time, the submission page could check the session for the key, delete the first record, insert the updated record, and store the new key in the session.  Alternatively, it could just call update on the old record instead of delete/insert.  I'm not sure what your data looks like, so I can't be sure what would be the best choice.

In any case, it seems like that would be more beneficial to the user than just blocking them from submitting it again.  You'll get the most recent 'version' that they tried to submit.
1. Try writing a Jscript that clears the form in every form load.

2. Give the user an ID when he/she enters the web site record it in session object and check if he/she made update

3. (This is not recommended by Microsoft and others) put your connection in session object and close it when you want.
Hummmsx,

Check the referenced question from my post... a far easier way to deal with it by using session variables.

iozturk,

#1- Try:

<body onLoad="document.form1.reset();">

#2- Covered in the referenced question from my post...

#3- I'm not even going there...

CR
Actually CRagsdell, I feel that the solution I suggested would be preferable over what you suggested in the other thread.  What if the user would like to change their option?  The reason they are hitting the back button is because they wanted to change something that they previously submitted.  In your suggested solution, you simply deny the user the ability to make changes.

The solution I proposed allows the user to make changes, resubmit the form, and know that their most up-to-date info was recorded in the database.  It might be very slightly "harder" than what you proposed, but it's much better for the end user, which is usually who we are trying to build these sites for.
Avatar of lance22

ASKER

I appreciate all the feeback as all of it was good.  In the end, I went with checking new submissions against identical records ... not easy as many of these records are scientific field tests which are nearly identical to begin with.  Thank you all very much.
Hummusx,

Sorry, but you evidently didn't review my sample very carefully. In my sample the user has a chance to change his form submission in the confirmation... with no need to hit the back button. Like you said, make it easier for the user...

CR