I've got to prevent folks from double-clicking the submit button on a fairly slow VFP function (which I am in the process of speeding up too).
Is there a way to disable the submit button on the client onClick before I run the server-side function?
ww:wwWebButton ID="btnNext" runat="server" Click="btnNext_click" Text="Next" CssClass="btn btn-success" Visible="True"
Sure - handle the form.onsubmit
event and disable it there in JavaScript code.
$("form1").submit(function() {
$("#btnSubmit") // make sure to check actual id - it may have container prefixes
.attr("disabled","disabled");
});
+++ Rick ---
Of course! Deal with it in the form submit rather than in the button click!
Thanks a ton!
Well you can also do it on the button click, but normally you do those kind of things when you submit.
Actually, the better way to do this I think is to pop up an 'processing' overlay if you expect the request to be less than instant (maybe with a setTimeout(()=> {}, 200)) and so block the entire form. There's a helper in
ww.jquery.js` for that sort of thing.
+++ Rick ---