Hi All,

Not sure this is the best place for this question, but I hope someone
can help.

I have a form which requires a lot of client side validation. As this
takes a while I am using an overlay to stop access to the form. The
problem is, the overlay only appears after all valition code has
exectured. Thus rendering it useless.

Standard stuff really... Large div with a class that has display:
none;

Form submit (onsubmit="validate(); return false;") calls the
validation code, which also submits the form if there are no errors.
See code below;

function validate()
{

        $('#messageOverlay span').text('Validating');
        var messageOverlay = $('#messageOverlay');
        $(messageOverlay).removeClass('hide');

        //VALIDATION CODE GOES HERE

}

Strangly the overlay appears if I place an alert in the validation
code??

I would really expect the overlay code to run first and dispaly the
message. Why does it only happen after all the code has executed?

I've tried so many things.. Like attaching the overlay code to the
button click and using bind() to attached the method calls seperatly.
Any help greatly appreciated.. If you sovle my problem and live / work
in London I will by you many beers!

Reply via email to