Alex Rivera | Logout

How to Prevent Users from Submitting a Form Twice

Asked 2013-05-29T12:41:10.123
21
<input type="submit" name="btnADD" id="btnADD" value="ADD"/>

when user click add button twice, from get submitted twice with same data into table. So Please help me to restrict user to submit from twice.

Edit
Report

2 Answers

3

You could notify the user that he drinks too much coffee but the best is to disabled the button with javascript, for example like so:

$("#btnADD").on('click', function(btn) {
  btn.disabled = true;
});
answered 2013-05-29T12:54:53.220
1

You can use JavaScript.

Attach form.submit.disabled = true; to the onsubmit event of the form.

A savvy user can circumvent it, but it should prevent 99% of users from submitting twice.

answered 2013-05-29T12:42:52.020

Your Answer