Fixing double lead submissions on WordPress forms caused by AJAX and caching conflicts

Overview

A client reported that form submissions from their website were being duplicated. Each lead appeared twice in their CRM, one submission included only contact details while the second added the user’s message. This behavior inflated reporting data and caused confusion for internal sales tracking.

Freshy’s development team investigated the issue and discovered that the double submissions were caused by overlapping AJAX triggers and caching behavior in the site’s WordPress environment.

Issue background

The client noticed a consistent pattern across all location pages:

  • Each lead submission appeared twice in the CRM or email inbox.
  • The first submission contained only contact fields (name, email, phone).
  • The second submission included all form data (contact details and inquiry message).

The problem occurred regardless of which form users filled out, suggesting that it was related to a shared form configuration or caching layer.

Diagnosis

Freshy’s developer reviewed the form setup and traced the issue through the following steps:

  1. Form platform verification – The site used a form plugin (Gravity Forms) embedded across multiple location pages, each pulling from a shared form ID. The duplication was not specific to one form, confirming the problem was systemic.
  2. Network request inspection – Using the browser developer console, the team monitored outgoing network requests on form submission. They found that two AJAX requests were triggered per click, one from the main form submission script and another from a secondary script loaded by the site’s caching plugin.
  3. Caching and minification conflict – The website was running WP Rocket, which combined and deferred JavaScript files for performance optimization. This process inadvertently duplicated the form submission handler function.
    The first request fired immediately on click, and the second was triggered by a deferred script after the DOM finished loading.
  4. Form validation check – The duplication persisted even when form validation was enabled, confirming that the issue was not user behavior (like double-clicking) but a code-level event firing twice.

Resolution steps

  1. Exclude form scripts from optimization – In WP Rocket’s settings under File Optimization → Excluded JavaScript Files, the following scripts were added to prevent duplication:
gravityforms.min.js
gravityforms.js
gform_gravityforms

This ensured that WP Rocket would no longer combine or defer these scripts, allowing Gravity Forms to manage its AJAX submission natively.

  1. Verify single request behavior – After clearing all caches, the developer tested several forms across different location pages. Each submission now triggered only one network request, and no duplicate leads appeared in the CRM.
  2. Implement a submission throttle safeguard – As an additional precaution, a lightweight jQuery function was added to disable the submit button immediately after the first click:
jQuery(document).on('submit', 'form', function() {
  jQuery(this).find('button[type=submit]').prop('disabled', true);
});

This prevented accidental double-clicks or browser resubmissions.

  1. Cache purge and propagation – All site and CDN caches were purged to ensure that the updated JavaScript settings propagated network-wide.
  2. Monitor for stability – The form activity was monitored over several days, confirming that no additional duplicate submissions occurred.

Final outcome

After adjusting the caching configuration and excluding the Gravity Forms scripts from optimization, the double submission issue was fully resolved. All new form submissions now appear once per user interaction, ensuring accurate reporting and clean CRM data.

Key takeaways

  • Double form submissions can result from duplicate AJAX triggers when scripts are minified or deferred.
  • Always exclude form-related scripts from caching or optimization tools like WP Rocket, W3 Total Cache, or SiteGround Optimizer.
  • Implement client-side safeguards such as submit button disabling to prevent user-triggered duplicates.
  • Regularly test after performance plugin updates, as caching behaviors can change.
  • Monitor CRM or email logs periodically to detect unexpected submission patterns early.

Having issues with duplicate form submissions or inaccurate lead tracking?
Contact Freshy for expert WordPress performance and form troubleshooting support.