Solved

Modal IE dialog calling function in parent

Posted on 2008-06-19
3
1,372 Views
Last Modified: 2008-10-01
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
Comment
Question by:yommm
3 Comments
 
LVL 9

Expert Comment

by:djon2003
ID: 21828141
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
 
LVL 22

Expert Comment

by:neeraj523
ID: 21828735
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
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 500 total points
ID: 21830504
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JQuery Syntax... 4 38
Copying table data to one another 15 31
ASP.NET MVC -Update model when click on <li> element 29 38
asp.net mvc 2 25
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question