[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1394
  • Last Modified:

Modal IE dialog calling function in parent

Experts:
I have a modal IE dialog opened by the snippet below. I would like the modal to call a javascript function in the parent IE window on close, with something like this
<INPUT type=button value=Close onClick="javascript:window.opener.focus();window.opener.Navigate(EventID);">
The problem is that i get an error, stating that window.opener is null or not an object. I am open to different solutions, as long as I can on close of the modal call my function in the parent.


Thanks for you help

<html>
<head>
<form method="post" action="test2.asp" name="ErrorCheck">
<title>Test</title>
<SCRIPT language="javascript">
function modalWin() {
if (window.showModalDialog) {
window.showModalDialog("errordisplay2.asp?","Error","dialogWidth:350px;dialogHeight:500px");
} else {
window.open("errordisplay2.asp?","Error","height=350,width=500,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes");}
}
function Navigate(EventID)
{
document.frmNavigate.action="ADCheck.asp"
document.frmNavigate.EventID.value=EventID;
document.frmNavigate.submit();
}
window.onload = modalWin;
</SCRIPT>
</head>
</body>
</html>

Open in new window

0
yommm
Asked:
yommm
1 Solution
 
djon2003Commented:
Here is a page explaining the use of Opener and another way of doing a navigation of the parent page :
http://www.webreference.com/js/tutorial1/opener.html
0
 
neeraj523Commented:
Hello

Modal Dialog is something which is compatible with only IE (as per my knowladge). Why dont you use window.open method ??

You can call a function from the parnent window on close of this pop window like this..

<body onBeforeUnload="opener.Navigate("arg")">
pop up Window
</body>
0
 
Albert Van HalenCommented:
Opening a modal window in IE will stop executing Javascript right after the call showModalDialog.
After the modal closes scripting continues, n fact showModalDialog is a function which returns a vaule.

EventID = window.showModalDialog("errordisplay2.asp?","Error","dialogWidth:350px;dialogHeight:500px");
if(EventID != null)
Navigate(EventID)

If a specify a window.returnValue property while closing the dialog, scripting from the calling window continues...

In case of multi browser situation you have to determine whether the popup is modal (IE) or not.
(Just check if window.opener != null)
To close the dialog (in your case it's handled by a button) you have to say :

window.returnValue = EventID;
self.close();
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now