I've built an ASP.Net MVC 5 application. Within one of the Razor Views, I have a Submit button which the user can click to send out emails and text messages. However, when the user clicks the Submit button, it can take 10 or 15 seconds for the messages to be sent out. Due to this time delay, users sometimes click the Submit button multiple times thinking that the first time clicking the Submit button did not work. Even with displaying warning information to users, NOT to click the Submit button multiple times, they still do so.
I now would like to disable the submit button for 4 hours. I'm able to disable the submit button using some JQuery
$('#myButton').prop('disabled', true);
However, this isn't much help, because if the user revisits the page or refreshes, the button can be clicked again. Instead, what I'd like is for the Submit button to be disabled for 4 hours from when it was initially clicked.
I'm really not sure what is the best way to do this. I know I could store the date time the button was clicked in my database and validate against that, but I'm not sure this is the best method. Perhaps a session variable could be used?
Has anyone ever came across a scenario like this before? Any advice would be greatly appreciated.
Thanks.