Troubleshooting

Duplicate Form Submissions: How to Stop Them on Static Sites

Double clicks, page refreshes and impatient retries all create duplicate form submissions. Here is where each one comes from and the smallest fix for each on a static site.

· The SimpleForm Team

You open your inbox and find the same contact message three times, two seconds apart. The sender was not spamming you. They clicked a button that gave no feedback, so they clicked it again. On a free plan that also means three of your 100 monthly submissions spent on one person.

Duplicate form submissions are repeated POST requests that carry the same data from the same visitor, caused by double clicks, page refreshes, or automatic retries. A static site has no server session and no page template that can check whether a form was already handled, so every one of those requests is accepted as a new submission. This article walks through where each duplicate comes from and the smallest fix for each.

Why do duplicate form submissions happen on a static site?

They happen because the browser is allowed to send the same POST more than once and nothing in between says no. A hosted form backend such as SimpleForm receives each accepted POST at your endpoint URL and records it. It cannot tell a visitor who meant to write twice from one who got impatient.

There are four common sources, and each needs a different fix:

  • Double click or double tap. The second click lands before the first request returns, often within a few hundred milliseconds.
  • Refresh after a native form post. The visitor lands on a result page and presses reload. The browser offers to resend the form data, and they accept.
  • Back button. The visitor goes back to the filled-in form and submits again, assuming the first attempt failed.
  • Script retries. Your own fetch error handler fires the request again on a timeout, even though the first request reached the server.

The last one is the most expensive to debug because it looks like user behaviour in the logs. If a pair of entries is always the same data, with the second arriving exactly your timeout value after the first, your retry code is the cause.

Which fix stops which duplicate?

No single fix covers all four sources, so match the fix to the cause. The table below lists what each fix blocks and what it leaves open.

FixStopsDoes not stop
Disable the button on submitDouble click, double tapRefresh, back button, script retries
Redirect to a thank-you page after successRefresh resending the POSTBack button, double click
Reset the form after a success responseBack-button resubmit of the same values, resubmit of a filled formDouble click before the response arrives
Retry only on network failure, never on a received statusScript-caused duplicatesAnything a human does

The first and last rows do most of the work for forms that submit with JavaScript. The second row matters if you rely on the plain HTML action attribute and no script at all.

How do you lock the submit button so a double click sends one request?

Disable the button and set an in-flight flag the moment the submit handler starts, then re-enable it only if the request fails. The flag matters more than the disabled attribute, because a keyboard user can press Enter in a text field and fire a second submit event without touching the button.

  1. Add a boolean such as sending outside the handler and set it to false.
  2. At the top of the handler, call event.preventDefault(), then return early if sending is already true.
  3. Set sending = true and disable the submit button, changing its label to something like "Sending".
  4. Send the request with fetch and the Accept: application/json header.
  5. On success, reset the form and show a confirmation in place of the button.
  6. On failure, set sending = false and re-enable the button so the visitor can try again.

In code, the guard looks like this:

let sending = false;
form.addEventListener('submit', async (e) => {
  e.preventDefault();
  if (sending) return;
  sending = true;
  button.disabled = true;
  try {
    const res = await fetch(form.action, {
      method: 'POST',
      headers: { 'Accept': 'application/json' },
      body: new FormData(form),
    });
    const data = await res.json();
    if (data.success) { form.reset(); return; }
    throw new Error('rejected');
  } catch (err) {
    sending = false;
    button.disabled = false;
  }
});

Notice that on success the flag stays true. The visitor has finished, so there is no reason to let the same page instance submit again without a reload.

How do you stop a refresh from resending the form?

Redirect the visitor to a separate thank-you page after the POST succeeds. The browser then remembers a GET request for the thank-you URL, so a refresh reloads that page instead of offering to resend the form data. This pattern is commonly called Post/Redirect/Get.

With SimpleForm you set a custom redirect URL on the form, and an accepted submission answers with a 302 to that address, as listed in the response codes in the documentation. That is all a plain HTML form needs, with no JavaScript. If you submit with fetch instead, there is no navigation to refresh, so the reset-and-confirm step from the previous section covers you.

The back button is the leftover case. Browsers often restore the filled-in values when someone goes back, so call form.reset() on success, and consider adding autocomplete="off" on forms where a restored message would be misleading.

When is it safe to retry a failed submission?

It is safe to retry only when the request never reached the endpoint. A network error, where fetch rejects before any response arrives, qualifies. A received 400, 402, 403, 404 or 429 does not, because the endpoint answered and a repeat will get the same answer.

The status codes SimpleForm documents map to retry decisions like this:

  • 400: the data was missing or invalid. Fix the data, do not resend it.
  • 402: the monthly plan limit is used up. Retrying cannot succeed before the limit resets on the first of the month.
  • 403: the origin domain is not allowed. Fix the allowed domain list.
  • 404: the endpoint token is wrong or inactive.
  • 429: the rate limit was exceeded. The documented ceiling is 10 submissions per IP per hour per endpoint, so a tight retry loop makes it worse.

A retry loop that treats any non-success as retryable can turn one failed submission into the 10 per hour that trigger a 429, which blocks real visitors on the same IP. Retry network failures once, after a delay, and show an error for everything else.

Can the backend remove duplicates for you?

Not by itself. The SimpleForm documentation does not describe automatic de-duplication, so plan on each accepted POST being stored as its own submission and emailed once. The honeypot field is a different mechanism. It silently accepts bot posts with a 200 and discards them, which is spam defence, not duplicate defence.

This is the point where doing it by hand gets tedious. Client-side guards cover most cases, but you still end up reading emails and scrolling a list to spot repeats, and an export is the only way to check at scale. A form backend that gives you a dashboard of every submission, plus CSV and JSON export on the Pro plan, lets you sort by email address and timestamp and remove the pairs in a minute instead of guessing from your inbox. You can see how the endpoint, dashboard and export fit together in the SimpleForm docs.

If you do get duplicates anyway, a short manual check works well. Export to CSV, sort by the email field, and look for rows with the same email and message within a few seconds. Delete the later row. That is also a useful test of your fixes: if the same pattern keeps appearing, one of the four sources above is still open.

What if you only get a few submissions a month?

Then the button lock and a reset on success are enough, and you can skip everything else. A handful of duplicates a month is a nuisance rather than a cost, and extra machinery on a small form is more code to maintain than the problem deserves. The calculation changes if you are on the Free plan with its 100 submissions a month, where a double-click bug on a busy page can eat the quota noticeably fast. In that case fix the button first, then check the plan limits against your real traffic before deciding whether to upgrade.

Next step: add a guarded endpoint to your form

Create a free endpoint, paste the URL into your form's action attribute, and add the guard from this article to your submit handler. Send yourself one test submission, double-click the button on purpose, and confirm only one entry appears in your dashboard. Create your free SimpleForm endpoint and the whole test takes a few minutes.

Frequently asked questions

The most common cause is a double click on a button that gives no feedback. The second click fires before the first request returns, so two identical POSTs arrive. Disable the submit button and set an in-flight flag in your handler, and the second request never leaves the browser.

It can, if the thank-you content was returned directly by the POST. The browser then offers to resend the form data on reload. Redirecting to a separate thank-you URL after success turns the last request into a GET, so a refresh only reloads that page and sends nothing.

Only when no response arrived, such as a dropped connection. If the endpoint answered with a 400, 402, 403, 404 or 429, a retry gets the same answer, and with a rate limit it makes things worse. Retry network failures once after a short delay, then show an error.

Yes, every accepted submission is a separate entry, so duplicates use up your plan allowance the same as real messages. On the Free plan that allowance is 100 submissions a month. Once the limit is reached, further submissions return a 402 until the limit resets on the first of the month.

Export your submissions to CSV, sort by the email column, and look for rows with the same email and message a few seconds apart. Delete the later row in the dashboard. CSV and JSON export are available on the Pro plan, while Free users can copy individual submissions.

Ship a working form in five minutes. Point your form's action at a SimpleForm endpoint and submissions land in your inbox and dashboard straight away. Start free or read the docs.

More from the blog