Avoiding duplicate forms submission

Occassionaly on a forms submission a user will hit the browser "back button" when he gets a confirmation form and change information and hit the submit button again.  This causes duplicates.  Thanks to you I have mastered the ability to post another form before submitting whcih solves most of my duplicate problems.

However on the final submission I would like the "page to expire" or preferably pull up a url with instructions of how to change your submitted information ..... I would like to prevent the form from coming back at all.

thank you
-bruce
bnp6622Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hhammashCommented:
Hi bruce,

On the Form Page:
-----------------
Open your form page in HTML view and paste the following code on top of the page before the <html>.  The form page should be an ASP page,  e.g: SubmitForm.asp

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

If your form is an HTML page SubmitForm.htm put this code after <head>

<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">


On the Confirmation page: (The page which appears after submitting the form)
------------------------------------------------------------------
Open your form confirmation page in HTML view and paste the following code on top of the page before the <html>.  The form page should be an ASP page,  e.g: ConfForm.asp

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>



If your form confirmation is an HTML page ConfForm.htm put this code after <head>

<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">


Then put the following code immeidately after <head>

<script language="JavaScript">
javascript:window.history.forward(1);
</script>

When the user click on Back Button the form will be lost.

If you have ASP support,  I prefer to name the pages with .asp otherwise put the code as I showed you.

hh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bnp6622Author Commented:
thank you again
-bruce
will try
0
hhammashCommented:
You are welcome bruce
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

hhammashCommented:
Hi Bruce,

What is the situation.

hhammash
0
bnp6622Author Commented:
Sorry... I thought I had accepted your answer.  One note, though,   I use your solution for the submit form that goes to the verify form.   Your above solution eliminates the back button to the submit form when you are on the confirmation form. which is great!  However hitting the back button twice returns to the original submit form.... though the form is empty.  Users could renter data again thinking it is a correction.   However I am happy with the way it works now.   I guess you cannot totally eliminate duplicate information.

-bruce
0
hhammashCommented:
If you have 3 pages,  put the code in the three pages.
0
bnp6622Author Commented:
I continue to stumble over the obvious.
thank you again.
-bruce
0
hhammashCommented:
You are welcome bruce
0
bnp6622Author Commented:
hh,

I have the forms working (thanks to you).
form1  sends info to form2
form2  posts database and produces confirmation form

When I close form2 in the browser, the information in form1 is still there.  I could re-submit the information again.  I don't recall this happeining in my last attempt at this.   Am I able to have form1 "not appear" once the information is "posted" on form2.

-bruce

I am somewhat embarassed here as I am unfamilar with adding points to an already answered question.  This is really an addendum to the original question..  Advise.

0
hhammashCommented:
Don't worry,

Did you put the lines I gave you in each page involved?

hh
0
bnp6622Author Commented:
Yes, I did (or thought I did.)   Let me recheck this and try again.
-bruce


0
bnp6622Author Commented:
hh,

I explained the problem incorrectly...   The back button solution works.  When I close the "confirmation" page, my original form page shows with all the information.  Hitting the submit button re enters the info again.

form1 posts form2
form2 posts db and initiates the "confirm page"  

I would like form1 to disappear when the confirm page is closed.

thanks
-bruce
0
hhammashCommented:
Easy:

When you submit the form do not submit to a new window.

Form 1 posts to form 2 in the same windows
Confirm page opens in the same window

Do not use New Windows

hh
0
bnp6622Author Commented:
hh,
Why I constantly overlook the obvious... I don't know.   I must have changed this on an experiment..

Thanks again so much for your help
-bruce
0
hhammashCommented:
You are welcome bruce
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.