1

I have a site where you can submit data into the db. Everything works fine but sometimes when I click to submit it takes long time. I noticed that some people try to click submit a couple of times while it is still loading and this way they insert the same entry more times in the database.

What is the solution for this problem?

Grasper
  • 1,293
  • 12
  • 26

1 Answers1

2

You can disable the button after the user submitted the form.

Here is a SO question/answer whith an example:
Disable button after submit with jQuery

If you don't use jQuery already you might use a vanilla js solution instead.

Community
  • 1
  • 1
jantimon
  • 36,840
  • 23
  • 122
  • 185
  • actually, I can't use this because I have a validation in place. So in case someone doesn't fill something, the submit button will become un-clickable for the second push. – Grasper Aug 21 '14 at 14:22
  • I guess I will need to implement it within the validation script. So your answer is still valid... – Grasper Aug 21 '14 at 14:28