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
--------------
lance22Asked:
Who is Participating?
 
thomasdoddsConnect With a Mentor Commented:
that should be:

EITHER wrap your data insertions with a check for existing data (which unfortunately makes another trip to your db) OR include a flag in your QueryString to perform the submission processing that way you can control the action ...
0
 
thomasdoddsCommented:
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 ...
0
 
CRagsdellCommented:
Here is a very similar question, with a couple of different ways to deal with your problem:

http://www.experts-exchange.com/Web/WebDevSoftware/FrontPage/Q_20540106.html

CR
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
HummusxCommented:
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.
0
 
iozturkCommented:
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.
0
 
CRagsdellCommented:
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
0
 
HummusxCommented:
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.
0
 
lance22Author Commented:
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.
0
 
CRagsdellCommented:
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
0
All Courses

From novice to tech pro — start learning today.