How do you prevent duplicate records from form submissions?
Disabling a button during submission improves the interface but does not replace server-side duplicate protection. Use an idempotency key or database constraint that identifies repeated requests for the same operation.
How to check it
- Identify the fields that uniquely define one operation.
- Send the same request twice concurrently.
- Retry after a network timeout, then read the persisted record count.
Concrete example
Example: the first application may be saved even when its response never reaches the browser. A retry should return the existing result or a controlled duplicate response.
Avoid a false conclusion
A read-then-insert check alone is vulnerable to concurrent requests. Enforce uniqueness in the database too.
Reference
VCT Editorial