Tech-Evangelist

Technical Articles, Musings and Opinions from Tech-Evangelist

  • Home
  • About
  • Guidelines
Previous article: Chinese Spam Comment Network Hitting WordPress Sites
Next article: Problems With Tech Support at Hosting Companies

A Fix for Duplicate Form Submissions with Contact Form 7

January 6, 2013 By Craig - Copyright - All Rights Reserved

A WordPress web site client recently raised an issue about an intermittent problem with duplicate form submissions with forms generated using the Contact Form 7 plugin. We did some research and found what appears to be a solution.

Multiple from submissions are usually generated by users who become impatient if they do not see a confirmation message immediately after clicking a form’s Send or Submit button. Sometimes the issue is related to slow form submissions, which are more of a server-related issue that is not under the control of a web site developer. With some sites, the Send or Submit button can be disabled using JavaScript, but that is not an option when using a plugin with WordPress. Neither plugins nor WordPress core code should be modified unless there are no other alternatives.

The Contact Form 7 messages rely heavily on JQuery, which is disabled in browsers when JavaScript is disabled. Furthermore, all active scripting, including JavaScript, is disabled when a user sets the security level to High in Internet Explorer. In other words, both error messages and confirmation messages are disabled with Contact Form 7 when a browser is configured to disable JavaScript.

I did some rooting around on the Contact Form 7 author’s site and found a fix for setting up a confirmation page that appears to solve the problem. There is a short piece of code that is added to the Additional Settings section on each Contact Form 7 editor page. You will find this section near the bottom of the editor page for each form that is created.

on_sent_ok: "location = 'http://www.mywebsite.com/request-submitted/';"

First, create a Page that contains a confirmation message. The user will be redirected to this page after submitting the form.

Second, add the code to the Additional Setting section, including a full URL to the confirmation page.

Third, do not forget to click the Save button.

Additional Settings code for Contact From 7

The problem was reported a few weeks ago. At that time the client was receiving multiple form submissions a couple of times each day. He just reported that there have been no duplicate submissions since implementing this fix.

Filed Under: WordPress Tutorials

Categories

  • Affiliate Marketing
  • CSS Tutorials
  • FileZilla Tutorials
  • Home Theater
  • Internet Marketing
  • Internet Technology
  • Kindle Tips
  • MySQL Tutorials
  • Online Auction Tips
  • Paint Shop Pro Tutorials
  • PHP Tutorials
  • Tech News
  • Thunderbird Tutorials
  • Video Production
  • Web Site Development
  • WordPress Tutorials
Content and images are copyrighted by Tech-Evangelist.com and others

Copyright © 2023 Tech-Evangelist.com - All Rights Reserved
Posted code samples are free to use. Do not reproduce or republish articles or content on another web site.

Privacy Policy : Terms of Use