aditya zen - Web & Mobile App Developer

How to Stop a Next.js Lead Form From Creating Duplicate Enquiries

me_adityazen
me_adityazen•November 28, 2026•5 min read
How to Stop a Next.js Lead Form From Creating Duplicate Enquiries

AI Overview

A disabled submit button improves feedback while a Next.js form is pending, but it cannot guarantee one database write. Add a server-checked submission identifier, validate inputs, commit once and return a stable result on retries. Test slow networks, double clicks and refreshes.

Summarize this article
ChatGPTClaudePerplexityGeminiGrokCopilot

A potential customer fills in a quote form, clicks Submit and sees no immediate response. They click again. The sales team receives two CRM records and perhaps two notifications; both look like separate leads. The visitor did the reasonable thing on a slow connection. The form should make that action safe.

Next.js form guidance shows how a pending state can disable the button and display progress during a Server Action. That improves the interface. It does not by itself guarantee that an HTTP retry, refresh or two simultaneous requests will produce only one lead. That guarantee belongs at the server and storage boundary.

Give the visitor an immediate, truthful state

Once submission starts, show a short “Sending your enquiry” state and prevent an ordinary second click. After a confirmed save, show a success message with a reference or a clear next step. If the request fails, keep the entered values and offer Retry. Do not display success merely because a network request was sent; the backend may have rejected it.

The Next.js pending-state example is useful for this UI. However, a JavaScript-disabled or interrupted browser may submit differently. Keep server validation and a durable response as the source of truth. My server-side form validation guide covers rejecting bad inputs; this article addresses legitimate duplicate requests.

Make one submission represent one intent

Generate a unique submission identifier when the form begins. Send it with the form and store it with a uniqueness constraint on the lead record. When the same identifier arrives again, return the existing result rather than inserting another lead or sending another notification. The insert and the deduplication check must be atomic; an application-level “look first, then insert” can race under simultaneous requests.

The identifier should survive a retry of the same form, but a new enquiry later needs a new identifier. Do not deduplicate only by phone number or email: one buyer may legitimately ask about two projects. If the CRM is external, preserve the identifier through the integration and check whether its API has its own idempotency support.

Test the behaviour that matters to sales

Throttle the network, double-click, open the same form in two tabs, refresh during submission and retry after a timeout. Confirm that the database has one record, the sales team gets one notification and the visitor sees a stable result. Test a second genuine enquiry from the same contact and make sure it still arrives. Log the submission ID and final status without copying sensitive message text into every log entry.

At adityazen, I can audit a lead form from browser to CRM. The goal is one trustworthy enquiry for each customer intent, even when the network is unreliable.

Author

me_adityazen

Full-Stack Web & Mobile App Developer building bespoke digital products.

Share this article

Related Articles

Available for New Projects

Have a Project? Let's Connect

Have an idea for a website, web app, or mobile application? Send a quick message with your requirements and let's bring it to life.