JS /JQuery Form Submit Delay?

I've implemented this 'locksubmit' plugin http://blog.leenix.co.uk/2009/09/jquery-plugin-locksubmit-stop-submit.html where it changes the display state of the button to disabled. I then want the form to be delayed by a few seconds before posting to the form URL.

What would I have to add in or modify to delay the form "post" once the user has clicked the submit button?



Cancel the default form submit behaviour, and start a timeout at the same time:

$('form').submit(function (e) {
    var form = this;
    setTimeout(function () {
    }, 1000); // in milliseconds

This should be compatible with the locksubmit plugin.

See a demo here: http://jsfiddle.net/7GJX6/

I think this is what you're looking for - modify lockSubmit() as such:

  setTimeout(5e3); // fancy 5 seconds

And with options object:

   submitText: "Please wait",
   onAddCSS: "submitButtons",
   onClickCSS: "submitButtonsClicked"

Basically javascript has to wait for all arguments to be resolved before executing the body. By setting timeout during the argument we delay the return.

Need Your Help

Standalone GUI client for TFS 2010 Source Control

tfs tfs2010

I'm looking for a TFS 2010 GUI client that I can use outside of an IDE. I'm only looking to use the source control features in this case. I'm not talking about work items or build management.

How can I check if a file exists on a remote server using PHP?


How can I check if a specific file exists on a remote server using PHP via FTP connections?