When the button is clicked, set a variable to the current time and return false from the handler to cancel the submit. When your ajax completes, do a settimeout for the difference between the variable you set and the min length of time you want to show the blockui. When the settimeout fires it can do the $("#myform").submit() to submit the form.
On Jan 12, 11:48 am, Vince <vli...@yahoo.com> wrote: > Hello all, > > I have this <form> and a submit button. > > I then try the following inside my document ready: > > $("#btnSubmit").click(function() { > > $.blockUI({ > theme: true, > title: 'My title', > message: '<p>My message...</p>', > timeout: 8000 > }); > > return true; > > }); > > Unfortunately the form is being submitted and completely disregards > the timout attribut I've set. > So I'm assuming there isn't a way to make blockUI synchronous and > really wait the timeout time and then, submit the form. > > The reason I'm asking is because I'm having the exact same scenario as > this post:http://osdir.com/ml/jQuery/2009-02/msg02094.html > > I'm using both IE and FF > > In a nutshell, between the blockUI and the return true I make an ajax > call. The time it takes varies a lot...it can be really quick like it > can take 15 seconds... > > When the call is quick, the users barely has the time to view the > blockUI and read what's inside...the form gets submitted but they are > like..."What happened? What was written there? I didn't have enough > time to read"... > > So to avoid, this, I always want a minimum of time for the blockUI to > appear even if the ajax call is quick. > > As for what happens if the ajax call is lets say...15 seconds...well > that's another story! > I'd first like to know if this is even possible...to NOT make my form > submit until it has reached the timeout attribute I've set inside the > blockUI parameters. > > Thanks in advance > Sincerely > > Vince