Javascript not completed before save

I have a form on the web, I am running a dblookup when a person clicks the submit button.

My problem is that the javascript function isn’t allowed to finish before domino attempts to save the document. So I get an error, I can’t seem to get the function to run from the submit button but prior to the onsubmit kicking off.

Does anyone know how I can get this done from a single submit button. The function runs the dblookup and if it finds a value change it will make a correction and then run the onsubmit.

Thanks for your time and opinion

Subject: Javascript not completed before save

You may have to insert a pause to allow the javascript to complete. 1000 is a second. Had the same problem in a web app and this seems to have cured it.

In javascript:

pauseComp(1000);

function pauseComp(millis) {

var date = new Date();

var curDate = null;

do { curDate = new Date(); }

while(curDate-date < millis);

}

Subject: Javascript not completed before save

Why, pray tell, is the JS function not being run by the onsubmit event? I assume you are using an AJAX-style call to do the lookup. If that is the case, make the request a synchronous one to force the browser to wait for a reply – an asynchronous request will defer the callback function and continue with the rest of your code, allowing the form to be submitted before the reply is received.