How can I prevent the user from double clicking submit button on my signup form which is an ajax partial view?
I regret to ask since this would have
UPDATE: submission was not working because onclick was not returning true
<input type="submit" value="Sign Up" onclick="this.disabled = true; return true;"/>
this will disable the button and the second click on the button won't work
Try with the following script:
$('form').submit(function () {
if ($(this).valid()) {
$(':submit', this).attr('disabled', 'disabled');
}
});
Make sure you execute it also in the success callback of your AJAX request in order to reattach the submit
event when the form is replaced with a new content in the DOM, or the second time it might no longer work.