Just noticed two issues with the code I send you. One was that you had
an 'return' in front of the setTimeout function which will return the
timer reference and cause the callbackClosure to not return false. The
other was that I didn't really have to bind/unbind for each validation
attempt, but only unbind once if the validation was successful.
See if that works for you:
------------------------------------------------------------------------------------------------------------------------------------------------
// when submitting the form, check the values to make sure they are numeric
$("#lePlanForm").submit(function() {
var retval;
// Give the user a processing message
$.blockUI();
var form = this;
setTimeout(function()
{
retval = checkForm();
// Undo the processing message
$.unblockUI();
jQuery(form).unbind('submit');
if (retval==true)
{
form.submit();
}
}, 10);
return false;
});
------------------------------------------------------------------------------------------------------------------------------------------------
-- Felix
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
RCS Computers wrote:
Felix,
Thank you, that did indeed give blockUI enough time to bring up the
message. However, it created another problem.
// when submitting the form, check the values to make sure they
are numeric
$("#lePlanForm").submit(function() {
var retval;
// Give the user a processing message
$.blockUI();
return setTimeout(function()
{
*retval = checkForm();*
// Undo the processing message
$.unblockUI();
}, 10);
return retval;
});
Notice that I use the return value of checkForm to stop submission of
the form if there are invalid values. Using the timeout function
seems to break this as the form is always being submitted. How do I
get the results of retval back from the setTimeout() function?
Thanks.
--------------------------------------
Randy Syring
RCS Computers & Web Solutions
502-644-4776
http://www.rcs-comp.com
"Whether, then, you eat or drink or
whatever you do, do all to the glory
of God." 1 Cor 10:31
Felix Geisendörfer wrote:
I've just looked at this real quick, but would something like this
maybe work:
----------------------------------------
|$.blockUI(messageElement); |
setTimeout(function()
{
| retval = checkForm();
|| $.unblockUI(); |
|}, 100);
|----------------------------------------
|
|It should give blockUI some time to come up before the current
thread get's pinned.
-- Felix Geisendörfer aka the_undefined
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
Mike Alsup wrote:
That's a problem. I see what you're doing, and I understand why
you're doing it, but I don't know of any way to force the browser to
render changes while you've got the current thread pinned. You really
need async behavior to make this work, but that's not an option for
you in your use case.
I don't have an answer for this. Anyone have any ideas?
Mike
On 2/21/07, RCS Computers <[EMAIL PROTECTED]> wrote:
Basically, I have some CPU intensive form validation that takes about 3
seconds to complete. I would like blockUI to start before the form
processing and stop after the form processing. However, the blockUI message
doesn't ever show up. When I comment out $.unblockUI(), the blockUI message
shows up AFTER the form processing is completed. Code can be found here (57
lines):
http://sh.nu/p/9301
I can arrange for the full HTML and JS if needed.
--
--------------------------------------
Randy Syring
RCS Computers & Web Solutions
502-644-4776
http://www.rcs-comp.com
"Whether, then, you eat or drink or
whatever you do, do all to the glory
of God." 1 Cor 10:31
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/