Javascript problem

Hello

I am facing a problem in my web based application. I have used AJAX in it.

There is one Parent form. On the parent form, there is one combo box, when I change the value in combo box, it would open popup using showmodaldialog function.

Code in combo box…

ProjectMaster(window, document.forms[0].username.value, document.forms[0].proj_category.value);

doLookup_ProjectDetails(this);

ProjectMaster: This function will open popup using showmodaldialog function.

doLookup_ProjectDetails: This function has a AJAX Request to fetch data from view…

When the first function runs it opens popup window which has button “ADD”. On the add button I have given javascript code…

window.close();

window.opener.document.forms[0].combo_box.click();

It comes back to parent window and then runs doLookup_ProjectDetails function in the parent window…

Problem : Sometimes doLookup_ProjectDetails function does not run. But if i put alert before doLookup_ProjectDetails function then it call doLookup_ProjectDetails function.

Please suggest what is the problem…

Thanks

Subject: Javascript problem

I had a problem a while ago very similar to yours. I was opening a pop up window using showmodaldialog and after closing the window was trying to set text in a div in the parent form and call some functions. I found adding an alert made it work but defeated the object of what I was trying to do.

I never did find out the cause of the problem but the following work around using a timeout worked for me.

JSHeader

function wait() {

setTimeout(‘executeFunctions()’, 1000);

}

function executeFunctions() {

window.opener.document.forms[0].combo_box.click();

}

Add button

window.close();

wait();