JavaScript implementation to prevent duplicate form submissions.