How to prevent a form sending multiple emails when clicking on Back browser button upon submission

  • bdoodle
    Asked on January 27, 2016 at 3:30 PM

    Hi,

    Background:

    My many Order forms all invoke my same Payment Form if the customer elects to pay via PayPal.  Control is passed to the Payment form via a URL on an Order form's Thank You page.  

    If the customer submits the Payment Form, he is taken to PayPal.  If the PayPal transaction is successfully completed, everything works perfectly.  If the PayPal transaction crashes or is aborted by the customer, a Pending email is properly created and everything works as it should.  In both these cases, Notifier and Auto responder emails are properly generated by the Order form.  

    The Problem:

    If the customer does NOT submit the Payment Form when control is passed there from an Order form, but instead hits his browser's back button, he is returned to the Order form screen and duplicate emails are immediately generated there.  They are identical to the original except for the {DATE} value which is a few seconds later. 

    How can I prevent this from happening?  The duplicates are being generated by the system, not by a customer inadvertently submitting the same form submission button twice. 

    Thank you.

     

    A sample Order form is:

    https://www.jotform.com//?formID=53286742922966

    My Payment form is:

    https://www.jotform.com//?formID=53253981193965

     

    NOTE: For now, I'm sending both the Notifier email and the Autoresponder email to myself.  So when the problem occurs, I get 4 emails instead of 2.

  • Kevin Support Team Lead
    Replied on January 27, 2016 at 6:41 PM

    You may set an unique submission on your forms, then you will prevent the issue that you are getting now, to do it just follow this guide: http://www.jotform.com/help/64-How-to-Set-Unique-Submissions-on-a-Form.

    Your submitter will receive a message saying that he/she is trying to submit the form again, and the submission will not be completed, because it was previously.

    Hope this helps

  • bdoodle
    Replied on January 27, 2016 at 7:28 PM

    The submitter did not submit the form a second time.  He merely returned to the form to view it again.  I don't want my customer getting a message that he is says he's trying to resubmit the same order when that is not the case.  

    My question is not how to prevent a duplicate submission, but how to prevent a form from sending duplicate emails.  The title to my question should not have been changed.

    By experimenting, I've found that if I change the Advance Preference to Don't Clear, I don't get the duplicate emails when I return to the form.  When I set the preference to Clear on Submission, I do get the duplicate emails.  Regardless of the setting, the form's fields are empty when I return to the form. 

  • Kevin Support Team Lead
    Replied on January 27, 2016 at 10:24 PM

    I submitted your form and checked your submissions, currently it's only being submitted once.

    Now, as I understand your issue, you do not want your users to fill the form, back again and then submit it again, generating two submissions, only with a little difference that is the submission date.

    The only way to avoid submitting the form twice is with the method provided above, otherwise, your users will be able to click on the back button, load the form with the data previously sent and just submit it again.

  • bdoodle
    Replied on January 28, 2016 at 1:03 AM

    Sorry. I was playing around with my setting and left it changed. The Clear Hidden Field Values on the form we're looking at is again Clear on Submit as it is on all my other Order forms.  With this setting, you will get a 2nd set of emails sent when you hit the browser back button from my Payment form. (See first post for details.)  My apologies for confusing the situation.

    As I said before, the user is only hitting the submit button once.  Control passes from the Order form to the Payment form.  If the customer then hits the browser back button, without doing anything else, he is returned to the Order form and the second set of emails is IMMEDIATELY generated from the Order form.  The customer did not hit the submit button a second time.  NOTE: The Order form's fields are all empty when control returns there after the first submission. The duplicate emails reflect the previous Order

    As I said above, it appears that I can put my Clear Hidden Field Values setting to Don't Clear and the duplicate emails will not be sent.  I will explore the ramifications of doing this and may go that route.  Regardless of my decision, I would think that there are others who definitely want Clear on Submit and don't want duplicate emails generated by the form.  

    This really appears to be a bug that Jotform would want to fix.  I may be content to change the Clear Hidden Field Values setting to resolve this problem, but I will not send the customer a message saying he is seeking a second submission when he only hit the submission button once.  Others will probably share my view.

    Thank you.

    P.S. Please change the post's title back. It does not deal with a user submitting a form multiple times.  Other forum readers may benefit from this thread.

  • Boris
    Replied on January 28, 2016 at 8:23 AM

    Thank you for providing the clarifications, I have changed the title of this thread to better reflect the issues being discussed.

    I understand what you are describing, but I was unable to replicate said issue on a cloned version of your form 53286742922966. I see that the Clear on Submit is selected, but upon clicking on the browser Back button, the form emails don't get resent on my end.

    I tested both in Firefox and in Chrome, and I only received the initial set of emails.

    Just to make sure that I followed the same steps, I did the following:

    - cloned your form, and set up email notification/autoresponder to go to my email;
    - submitted my form;
    - got automatically redirected to your PayPal form, and received email notifications from my form;
    - used my browser Back button to return to the initial form.

    I did not receive any duplicated emails, even after testing in multiple browsers and over both jotform.com and jotformpro.com form domains.

    From what you are describing, it sounds like your browser is redirecting you to the submit page (jotform.com/submit/form-number) which should be invisible and not stored in your browser history, instead of redirecting you directly back to the form page (jotform.com/form/form-number).

    Are you still experiencing this issue with the sample order form you provided earlier? If so, may we know what browser you are getting this issue on - is it just on one browser, or if it works that way regardless of the browser you are using?

    Please let us know. Thank you.

  • bdoodle
    Replied on January 28, 2016 at 9:57 AM

    Thank you for addressing my real issue.  You are right.  The form you tested is now working.  I tested it at 12:25 am and I got 4 emails.  I don't understand why it's working now.  I just tried a different Order form I have and got the duplicate emails.  Please try to replicate the problem with:

    https://www.jotform.com//?formID=53365702790963

    In the test I just did, I got 2 sets of duplicates!  I used the browser to return to the Order form and got one dup set, then hit browser back a second time followed by browser forward and got a second dup set of emails.

    I have been using Chrome.  

    I just tried the same form on Firefox and got no duplicates.  Somewhat sheepishly, I must admit, in view of this evidence, that perhaps Jotform is not necessarily the (whole) problem.  I would, however, appreciate any assistance you can give me to understand how this is happening.  It seems very odd that I don't get the problem using Chrome when I change the one setting to Don't Clear in Jotform, but don't get the problem regardless of the setting using Firefox.  People will be using Chrome and I don't think my Chrome is set up in an unusual way. As it is, I will still have to change all my Order forms to Don't Clear to be safe. 

    Thank you for your persistence and patience in this matter.

  • Charlie
    Replied on January 28, 2016 at 12:19 PM

    I just read the discussion above, may I know how you are able to replicate the problem? Are you submitting the form using the form's direct link (in your latest form this is the direct link http://www.jotformpro.com/form/53365702790963). OR are you submitting directly on your website where the form is embedded?

    If I understand it correctly, multiple emails were sent because multiple submissions exist.

    I made a test submission on this link http://www.madsails.com/Order_MC_Scow_sailsTest.html and on this form https://www.jotformpro.com/form/53365702790963, I tried pushing the back button but I'm also unable to replicate the problem.

    I noticed that your "Auto Fill" feature is enabled and the "Save on data changes" is unchecked.

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 1 Screenshot 20

     

    It is possible that the submit page retains the value when you hit the back button because of the auto fill feature, especially the "Save on data changes" is unchecked. I would suggest disabling this first and see if it gives you a different result.

    If the problem only shows up on the form embedded on a website, then the submit page might be reloading due to a code conflict. Would it be possible to embed the order form using the iFrame embed code instead? We'll wait for your response.

  • bdoodle
    Replied on January 28, 2016 at 12:46 PM

    No. Multiple submissions do NOT exist. The submit button was not hit more than once and control does not pass to the Payment form more than once. 

    I've encountered the problem on Chrome when accessing several of my forms.  The problem doesn't seem to happen when Jotform tries it and then, after that, no longer for me either.  However, please try: 

    http://www.madsails.com/Order_XBoat_sailsTest.html

    I just tried the above form and got the duplicate emails three tests in a row. 

    I will not use the iFrame embed code because of other issues this causes me with these forms.  I want to retain my autofill features as is.

    I hope that using my URL above on Chrome, someone there is able to replicate the problem.

    Thanks.

  • Kevin Support Team Lead
    Replied on January 28, 2016 at 2:29 PM

    I just tested your form and I could not replicate your issue, I see that you received the notification and I received the autoresponder, then I clicked on the back button on my browser and checked again the email history for your email and mine and I could not find duplicated emails.

    Also, when I clicked on the back button and went to the form again, I could see that the data previously sent was cleared.

    Could you please try again? 

    Your form seems to be working now.

  • bdoodle
    Replied on January 28, 2016 at 2:44 PM

    I just test it again and got duplicates.  I have forwarded the 4 emails to you.

  • Kevin Support Team Lead
    Replied on January 28, 2016 at 4:31 PM

    Yes, I received the duplicated emails, than you for sharing us that info, I also checked the email history for your email address and I can see the duplicated emails sent to you.

    However, I did a test using your email address and I only received one email, I tested again, now using your email address, and I can see that only email is being sent, one for notifications, and one for autoresponder.

    This is quite odd, I selected the same options than you, and I'm still unable to replicate your issue, I tested using the link you provided above and the direct link to your form.

    Could you please trying to re-embed your form?

    And also try testing both links, the link where you have embedded your form and the direct link to your form, do let us know the result.

  • bdoodle
    Replied on January 29, 2016 at 10:58 AM

    Hi Kevin,

     Thanks for your efforts.  

    The embed script hasn't changed.  I don't understand what you mean by re-embed.  Also, I only know how to test using my website page where I have embedded my form.  I don't know how to test with a "direct link."  However. . .

    I just retested the form 9 times in a row.  (I have made no revisions since the prior test I did that generated the duplicate emails that I forwarded to you. )  Every test included the following actions:

     

     

    X Boat Order form – complete form, select Payment Method of PayPal, hit Complete Order submit button to present Payment form

    Payment form – hit browser back button to return to X Boat Order form

    The results were as follows:

     

    (Note: I should NOT be getting duplicate emails and input should NOT remain on the Order Form after submission.)

     

    Test #

     

    Extra actions before or during test

    Duplicate emails received?

    Input on Order Form remained when returned there?

    1

     

    Yes

    Yes

    2

     

    Yes

     

    3

     

     

     

    4

     

    Yes

     

    5

    Cleared Jotform cache before test

     

    Yes

    6

    Made 1 update to Payment form before hitting back button to Order form

     

    Yes

    7

    Cleared browser cache before test

    Yes

    Yes

    8

    Hit Clear Form button on Order form before test

    Yes

     

    9 (same as 6)

    Made 1 update to Payment form before hitting back button to Order form

    Yes

    Yes

     

  • Kevin Support Team Lead
    Replied on January 29, 2016 at 12:29 PM

    With re-embed, I mean, embed your form again in your website, using the default method since you say that using the iFrame method generates other conflicts in your website.

    I saw on the emails that you forwarded to me, that even autoresponders where being duplicated.

    I did this test:

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 1 Screenshot 30 

    I just received this email: 

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 2 Screenshot 41

    I checked the email history for your email address and I can see that only one email was sent.

    This is a really odd issue, since we are not able to replicate it, I have not cleared my browser's cache, it's the same as when I did the previous tests.

    By the way, with direct link, I'm referring to this link: http://www.jotformpro.com/form/60184350886965.

    Have you tried using it?

    If not, please do it, and let us know if you experience the same issue than trying with the embedded form in your website.

  • bdoodle
    Replied on January 29, 2016 at 1:39 PM

    Ok.  I tried using the direct link twice. Both times, I got no duplicate emails, but the input on the Order form was NOT cleared.

    Then I "re-embedded" my form and reinstalled my webpage and did another test.  I still got duplicate emails, but the Order form WAS cleared.

    Please note that when I say duplicate emails, I mean that both the notifier and autor-responder emails are duplicated.  

    ==================

    By the way, I just tested another one of my similar forms 6 times.  

    The first 2 times, I got duplicate emails and the input was NOT cleared.   I changed the Clear Hidden Field Values from Don't Clear to Clear on Submission between tests but the results were the same.  I thought that having Don't Clear (see my earlier post) would preclude my getting duplicates, but that is not the case!

    Before the 3rd test, I hit the Clear Form button on my Order form.  In both the 3rd and 4th test, I did NOT get duplicate email and the input WAS cleared.  Note that after hitting the Clear Form button in the X Boat tests above, I did not get so good a result. 

    On the fifth test, I made a token update to a field on the Payment form before hitting the back button. I did NOT get duplicate emails, but the input on the Order form was NOT cleared.  

    On the sixth test, I made no changes (except to some details on the Order form), but half an hour had elapsed between test 5 & 6.  I got duplicate emails and the input was NOT cleared.

    It's disturbing that I get different results for the same tests.  No one else is using these forms or webpages.  And I usually do the tests one after the other, sometimes making no changes what so ever, but still get varying results. 

    NOTE: You are performing the test, per your last post, exactly as I do. 

    =====================

    Finally, I decided to test what happens if I select Check instead of PayPal on my Order Form  With this method, the customer is taken to a Custom Thank You page instead of my Payment Form.  As a 7th test, I hit the browser back button on the Thank you page.  I got duplicate emails, but the input had been cleared on the Order Page.

     

    At this point, I know no way to guarantee that duplicate emails will not be sent or to guarantee that my forms will be cleared of input upon submission.  The solution to the former problem is absolutely required.  I could live without a solution to the second problem, but hope I don't have to.

  • Mike_G JotForm Support
    Replied on January 29, 2016 at 8:38 PM

    I'm sorry, but in order for me to further test your situation, I have to make submissions directly from your form embedded on your website. 

    On my first test, I have used my own email address and submitted the form. Following the process that when I got redirected to your PayPal form I will hit the back button of my browser. I didn't get any duplicated emails upon doing that. I tried to make another test submission but still was unlucky to reproduce the issue you're having on that second attempt.

    As for my third attempt, I tried to use the email address that you've been using when filling up the form from your website(dudle****@comcast.net), but I'm still unable to reproduce the issue. 

    We would like to really apologize for any inconvenience, however, can you try if by using a different computer, different browser and/or different email address, you will still get the same issue?

    We will wait for your response. Thank you.

  • bdoodle
    Replied on January 29, 2016 at 11:59 PM

    Ok.  

    The problem has not occurred when I have used firefox.  I think the browser autofill settings were off and I tried to set them on.  Not sure I succeeded. After this change, still did not get duplicates. 

    When I use IE and hit browser back button after Order submission, I get the Order form page with a blank space where the form should be.  If I then hit refresh, I get message that the browser will resend the transaction if I proceed, possibly causing a duplicate, and that if I don't want that, I should hit cancel. If I do proceed, I get the duplicate emails. 

    I tested using Chrome on a different computer and got duplicate emails.  

    I changed my email address and tried a few more tests.  Once, I got duplicate emails. 

     

  • Boris
    Replied on January 30, 2016 at 8:43 AM

    I've checked your website, and the good thing is that there aren't any scripting conflicts there:

    http://www.madsails.com/Order_XBoat_sailsTest.html

    Same as you, I've tested by submitting the form on that page above in Chrome (version 45.0.2454.85 and version 48.0.2564.97), but I did not receive duplicated emails.

    I've used our support@jotform.com email address, made two separate submissions with Chrome 45, and one more with Chrome 48, but we only received one autoresponder per submission. Three emails in total, for the three separate submissions.

    Upon using the Back button in Chrome, initial form was loaded with all values correctly cleared, and it wasn't resubmitted automatically.

    I've also tried with Internet Explorer, and it did not resend the form automatically either. When using the back button in IE, and upon reloading it, IE gave out a warning that the form may be resubmitted again:

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 1 Screenshot 20

    This happens because Internet Explorer is saving the "interstep" between when the form was loaded, and when it redirected to PayPal form. In order to go back to the correct page in Internet Explorer, you would have to click on the Back button twice - this is unfortunately caused by IE browser behavior.

    Other than that, I couldn't replicate the issue. Since we can't reproduce the issue on Chrome, but you can consistently reproduce it there, it may be caused by a configuration option or an extension you are using in Chrome. Could you please try opening your webpage in an incognito window, and see if you also get a duplicated email when using the Back button in Chrome's incognito mode?

    Please let us know. Thank you.

  • bdoodle
    Replied on January 30, 2016 at 10:44 AM

    I'm using chrome 48.0.2564.97

    I got no dups with several tests of chrome incognito.

    I reset all Chrome settings to the original defaults. After that, I sometimes got dups, sometimes not.

    I disabled my only enabled chrome extension, restarted chrome, and retested.  I still get dups.  

    Today the input has been cleared during all tests.

    Reminder: I got dupes testing from a different computer yesterday. 

    P.S. I'm going on vacation, so will not be able to test after today.  I really appreciate your efforts to replicate the problem.  

  • Boris
    Replied on January 30, 2016 at 12:14 PM

    So you are pretty much using the same Chrome version (48) that we were testing on as well.

    It is encouraging that:

    1) tests in incognito window did not create duplicate emails, because it indicates that a problem may be related to something in your browser cache;
    2) the input fields were cleared today in all tests.

    Still it is very strange that even resetting Chrome to its default settings sometimes causes duplicates and other times does not.

    I also understand that you reproduced the issue on at least two computers. Were they both running Google Chrome? If yes, were they both signed into the same Google account, in that all bookmarks and data are synced between the two browsers?

    This may be a bit tedious, but you can try using Google Chrome Portable, which will have its own fresh browser profile without any non-default settings: http://portableapps.com/apps/internet/google_chrome_portable

    Portable version is convenient because when you are done testing, you can simply close the portable browser and delete the folder it was installed in, without impacting your current installation.

    I'm sure that there is a logical reason why it is caused on your end and not on our tests, we just have to figure out what it is, so that it can be resolved or reported to our developers.

    We are also always here, so when you return from your vacation, you can simply contact us again and we will be happy to continue testing and troubleshooting the cause of your duplicated emails. Please enjoy your vacation. :)

  • bdoodle
    Replied on January 30, 2016 at 1:08 PM

    Thanks for your quick response.

    The second computer I tried (that also sometimes had duplicates) was running Chrome, but it was NOT logged into the same Google account.

    I will try Google Chrome Portable and get back to you when I can. 

    Thanks for your continued support.

  • bdoodle
    Replied on January 30, 2016 at 1:19 PM

    I just tested with Google Chrome Portable and the first test resulted in duplicate emails.  Input fields were cleared.

  • Mike_G JotForm Support
    Replied on January 30, 2016 at 8:34 PM

    I'm not 100% sure, but I think I found what's causing your issue. 

    When you access your form through your website, http://www.madsails.com/Order_XBoat_sailsTest.html and submitted it, that's the time it creates duplicate submissions

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 1 Screenshot 70

    Notice that when you press and hold the back button it will show you two previous history of your website even if you just loaded it and submitted the form once.

    Selecting the first one on the list will create duplicate submissions.

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 2 Screenshot 81

    After you click the first one, notice that on your website, the back button is still active(not greyed-out) when it should not be and there still another previous history listed.

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 3 Screenshot 92

    This is somehow what's causing your issue.

    If you try to submit your form directly from its link, this doesn't happen

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 4 Screenshot 103

    Checking your email history, will show you that I was able to reproduce the issue. 

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 5 Screenshot 114

    I also received two emails at almost the same time

    How to prevent a form sending multiple emails when clicking on Back browser button upon submission Image 6 Screenshot 125

    I still need to make further testing and research on what's causing this. I'll try to get back to you as soon as possible. 

    Thank you.

  • bdoodle
    Replied on January 30, 2016 at 10:32 PM

    Thanks very much!

  • Kevin Support Team Lead
    Replied on January 30, 2016 at 11:45 PM

    I just tested, based on the explanation given by my colleague Mike_G and I can see the same on my end, however, I'm still unable to find what is causing it, I will ask to my colleague and update you her as soon as possible.

  • bdoodle
    Replied on February 8, 2016 at 4:52 PM

    Hello,

    Any updates?

    I have just retested about 20 times.  Most of the time, when using Chrome, I get duplicate emails when I hit the browser back button to return to my Order Form after it was submitted.  I have never gotten duplicate emails using Firefox, and I get a Confirm Form Submission message when using IE.

    Today again, I used 2 different computers and got duplicates on each of them.  

    I do see that the previous order form page appears twice in browser history as Mike discovered. That may help someone find the problem, but in itself, does nothing for me.  It may also be indicative that the duplicates appear not to occur when the form is invoked via a "direct link". 

    I believe that I'm not the only one with this problem.  When I look through your forum, I see others who may have experienced the same problem, but people ASSUMED the user hit the submit button twice. I discovered the problem during my own testing and know that all I did was hit the back button.  Some of the other forum questions that might have reflected the same problem are:

    http://www.jotform.com/answers/323895-How-to-prevent-duplicate-forms-when-using-browsers-back-and-forward-button-

    http://www.jotform.com/answers/252539-How-To-Prevent-Mulltiple-Submissions-Of-Forms-In-The-Same-Session

    http://www.jotform.com/answers/543478-I-am-receiving-double-registrations-for-each-participant

     

    http://www.jotform.com/answers/465599-Is-it-possible-to-block-double-click-on-buttons

     

    I do not think it would be extraordinary for a customer of mine to-

    submit an order to be paid by check, be taken to a Thank You page, and hit the browser back button.

    or to

    submit an order to pay via PayPal, be taken to my PayPal Payment form page, and hit the browser back button instead of proceeding.

    I do not want to implement my forms if duplicate emails will be generated much of the time when the user does one of the above actions.  My emails go to a store owner who treats each email as an order.  

    I won't use the loose or strict limits (uniqueness testing) since . . .

    some of my customers might want to submit multiple orders from the same form within a couple hours

    and

    none of them should receive a message saying they made a duplicate submission when they didn't.

    Please keep looking for a solution.

    Thank you.

  • Mike_G JotForm Support
    Replied on February 8, 2016 at 6:30 PM

    I would like to apologize for any inconvenience. Honestly, I'm not sure what's really causing this, but I believe it might be on your server or a conflict between your website scripts and the script of your form. As you have noticed, the issue is not occurring if you'll just use the direct link of your form. I understand that you refrain from using the iframe code in embedding your form as that would result towards many other conflicts but, I would suggest you try to use the iframe code for now and see if the issue with the back button still arises after. 

    Getting-the-Form-iFrame-Code

    We look forward to your response. Thank you.

  • bdoodle
    Replied on February 10, 2016 at 1:45 PM

    Hello,

    I tried two things: the first was the iFrame method of embedding my form and the second was getting several friends living in a 100 mile radius to test my form with their variety of devices.  In both cases, the duplicate emails continued to appear some of the time.  About 1/3 of my friends got duplicate email. I don't understand why none of you has been able to replicate the problem unless you are all working in a strictly controlled environment with test devices configured the same. 

    Have you referred this to your developers or are you waiting until you are able to replicate the error?

    Can you think of any other creative way to solve my problem?  

    We need to focus on the fact that it's the email that's (sometimes) duplicated, not the whole submission function. 

    This seems like an error that others must be experiencing and that should be addressed.  If I can't solve this, I may have to hire a web developer to code everything I've done without Jotform.  I don't want to do that.  Please keep trying to solve this problem.   Thank you.

  • victor
    Replied on February 10, 2016 at 3:23 PM

    Hi bdoodle,

    This is a big thread and would like to recap on the issue you are having. If I understand correctly, duplicated emails are sending out when users hit the BACK button of the browser. Can you please indicate if they also get duplicated emails when submitting the form the first time? (I do not think this is the case)

    When submitting a form, it is never recommended hitting the BACK button. Browsers have cache memory and could be causing conflicts. Many sites including banks and airlines, do not recommend hitting the BACK button, as this can create duplicated data.

    Can you please advise users to clear the cache and advise not to hit the BACK button.