views:

82

answers:

2

ok i have a form on which i have some validation through dataannotation which is client side as well as server side validation like some field already exists. i have no javascript validations on the page. now my problem is that what should i do if the user presses the save button multiple times (he keeps pressing the button for 15 times,in my case the page stays there with field already exist message at the top ) . what do u guys do for that?

what i have done (this works fine in firefox but not in ie) it disable the button no matter what just after click in ie

  $(document).ready(function () {
     $("#btn").submit(function () {
         $('#btn').attr('disabled', 'disabled');
     });
 });
A: 

try using .live or you could hide the button after it is pressed.

$(document).ready(function () {
     $("#btn").live("click", function () {
         $('#btn').attr('disabled', 'disabled');
//or
         $('#btn').hide();
     });
 });
Dave
+2  A: 

Put an overlay above the whole page. The overlay prevents the user from clicking twice and gives some feedback. The blockUI plugin does this very well.

EDIT:

$(document).ready(function () {
 $("#btn").click(function () {
     $('#btn').attr('disabled', 'true'); // Disable the button if you like
     $.blockUI(); // Blocking the page with a standard message.
 });
});
Christian13467
nice but if some one give me help on the code that would be great?
mazhar kaunain baig