Problem refreshing the parent page when closing a modal window.
I have page that opens a modal window from a report link column. In the modal window I want to be able to make my changes and press an Apply button so that the modal window is closed and the parent page is refreshed to show the modified details in the report. In Firefox all works well but in IE I get the error message ‘Window.opener.location is null or not an object’ .
When I comment out window.opener.location.href=window.opener.location.href; the modal window closes without error but I want to refresh the parent page with changes made in the modal window.
I’m afraid my java script is very limited (the code is based on other peoples examples.)
Parent Page I call this function from a report link column to display a modal window. Sets the hidden SAVE_STATUS field in destination page to ‘N’
function modalWin(pshow)
{
var url;
url='f?p=&APP_ID.:'+pshow+':&SESSION.::::SAVE_STATUS:N';
if (window.showModalDialog) {
window.showModalDialog(url,"name","dialogWidth:650px;dialogHeight:700px"); }
else {
window.open(url,"name","height=700,width=650,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes");
}
}
Destination page (modal window)
HTML Header.
The function closeWindow should refresh the parent page and close the modal window.
<base target=_self>
<script language="JavaScript" type="text/javascript">
<!--
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
function closeWindow() {
if ( document.getElementById("SAVE_STATUS").value == 'Y' )
{
window.opener.location.href=window.opener.location.href;
window.close();
}
}
//-->
</script>
Html Body attribute.
onLoad="closeWindow();"
P_UPDATE_DATE process called from the Apply changes button. Sets the SAVE_STATUS flag to ‘Y’ for the onload in the html body.
UPDATE event
SET event_date = :P5001_EVENT_DATE
WHERE contract_reference = :P330_EVD_CONTRACT
AND event_number = :P330_EVD_EVENT_NUMBER;
:SAVE_STATUS := 'Y';
Thanks in advance, I will have a look when back in the office on Monday.
Cheers Pete