Web Connection
wwWebButton disable before ww Click is submitted?
Gravatar is a globally recognized avatar based on your email address. wwWebButton disable before ww Click is submitted?
  Michael Hogan (Ideate Hosting)
  All
  May 12, 2021 @ 11:18am

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"

Gravatar is a globally recognized avatar based on your email address. re: wwWebButton disable before ww Click is submitted?
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  May 12, 2021 @ 02:55pm

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 ---

Gravatar is a globally recognized avatar based on your email address. re: wwWebButton disable before ww Click is submitted?
  Michael Hogan (Ideate Hosting)
  Rick Strahl
  May 12, 2021 @ 03:41pm

Of course! Deal with it in the form submit rather than in the button click!

Thanks a ton!

Gravatar is a globally recognized avatar based on your email address. re: wwWebButton disable before ww Click is submitted?
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  May 12, 2021 @ 04:23pm

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 inww.jquery.js` for that sort of thing.

+++ Rick ---

© 1996-2021