[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

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
0
bnp6622
Asked:
bnp6622
  • 8
  • 7
1 Solution
 
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
 
bnp6622Author Commented:
thank you again
-bruce
will try
0
 
hhammashCommented:
You are welcome bruce
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now