On my continued google travels I found this page that I think provides the best work-around:
http://blog.josh420.com/archives/2008/02/how-to-disable-the-submit-button-ofweb-form.aspx Cheers Jeremy Jeremy2009 wrote: > > Hello, > > I am implementing a 'double-submit' prevention strategy by pre-pending the > relevant wicket component's 'onclick' handler with "this.disabled=true". > This works fine for components that are translated as normal HTML buttons > ie <input type='button'> and that form submission only involves javascript > in the onclick handler (eg using AjaxButton): > > Eg, > > <input type="button" onclick="this.disabled = > true;wicketShow('ajaxIndicatore2');......bind(this));;; return false;" > value="Change password" name="submitButton" id="submitButtoned"/> > > (NB I have removed the bulk of the ajax javascript code in the onclick > handler for clarity). > > When uploading a file and using the wicket UploadProgressBar class, > there's javascript placed in the HTML form's onsubmit handler. This > handler is ONLY fired if you use a HTML submit button <input > type='submit'>. Using a standard HTML button and using it's onclick > handler to submit the form does NOT call the form's onsubmit handler > before the form is posted to the server. This is expected browser > behaviour as far as i can tell. > > Eg, > > <input type='button' onclick='this.form.submit()'/> > > ...submits the form, but the form's onsubmit handler does not fire. > > My problem comes when the following happens: > > <input type='submit' onclick='this.disabled=true'/> > > ...this disables the submit button and calls the form's onsubmit handler > (as evidenced by placing javascript alert('here') messages in the > generated HTML onsubmit handler) BUT it cancels the posting of the form > and instead the page reloads, as far as i can tell. According to various > web sites, it's expected behavour that disabling a submit button cancels > the form being posting. > > So, if i want the form's onsubmit handler to fire and allow the > UploadProgressBar to work, how am I to prevent a user from double-clicking > the submit button when uploading a file? Hopefully, I am missing > something obvious... > > Kinds regards > Jeremy > > -- View this message in context: http://www.nabble.com/Double-submit-issue---disabling-HTML-submit-button-causes-form-posting-to-be-cancelled-tp22698742p22702058.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org