Javascript function

I have one form on which there is a button in which code is written

window.showModalDialog(“http://”+server+“/”+database+“/formname?OpenForm&empcode=”+abc ,DetailsDialog,“dialogHeight:260px;dialogWidth:420px;dialogLeft:400;center;no;no;no”);

When I click the button it will open the second form in the dialog box. Now when clicking on the submit button on the second form, second form closes and a value is assigned to a field on first form with this code

window.dialogArguments.temp=“A”;

This above code is given in the Submit button of the second form.

When this value is assigned to field on the first form then I need to execute a javascript function on the basis of change in field. This javascript function is in the JS Header of the first form.

How do I do that???

Please help thanks.

Subject: Javascript function

You are using the correct method, window.opener doesn’t work with modal windows.

They way I do this is I have a js function in the opener, this opens the mocal window. That function then sits and waits to continue after the modal window is closed.

So in the modal window, set a temp variable as you are now, then in the js function in the opener, right after you have the code to open the modal window, check the field value and call the js function you need. So you DO NOT call the function from the modal window, it’s called in the opener as the modal window is closed.

Subject: Javascript function

Firstly to set value in the parent window you need to use window.opener. Secondly the function you need to run, call the function in a button and then in the Submit of the popup call window.opener.button.click()

–SOUMYAJIT

Subject: RE: Javascript function

I am sorry I am not able to understand.

Is this window.opener will work with modal dialog box. because my second form opens in modal dialog box.

Subject: RE: Javascript function

Tell me when you set value to the parent document, is it getting set???

If yes then forget window.opener and simply call the button (in which your function is called as described in the previous post) with window.button.click().

Make sure to keep the button hidden

–SOUMYAJIT