I have been searching the this forum trying to find the solution to my problem. This thread thread216-84313 seems to be the same problem, but doesn't give a solution.
To start, I am using IE 5.5 on a Windows 2000 machine.
Here is the problem:
I have two pop-up windows opened from another pop-up window (Product and Client are opened from Sales). The onUnload event on both Product and Client set hidden fields on Sales before closing the pop-up. The function on Product works (existing code, not written by me), and the code on Client doesn't. I keep getting "objParentWindow.document.frmSales.txtClientID is null or not an object." To me, they look exactly the same. Any ideas?
Here are the pertinent parts of the files:
SALES.asp
<script language="javascript">
function cmdProduct_OnClick()
{
strURL = "Product.asp?prodID=" + window.document.frmOpportunity.cboProduct.options[window.document.frmOpportunity.cboProduct.selectedIndex].value + "&ManufID=&CategoryID=&OppoID=<%=intOppoID%>&projid=<%=intProjectID%>&Source=<%=strSource%>";
window.open (strURL,'NewProduct','left=20,top=45,height=400,width=780,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,titlebar=yes')
}
function cmdClient_OnClick()
{
strURL = "Client.asp?contractorID=" + window.document.frmOpportunity.cboTileContractor.options[window.document.frmOpportunity.cboTileContractor.selectedIndex].value + "&OppoID=<%=intOppoID%>&projid=<%=intProjectID%>&Source=<%=strSource%>";
window.open (strURL,'Client','left=20,top=45,height=140,width=400,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,titlebar=yes')
}
</script>
...
<form name="frmSales" method="post" action="sales.asp">
<input type="hidden" name="txtClientID">
<input type="hidden" name="txtProductID">
...
<input type="button" value="Add/Edit Client" name="cmdClient" OnClick="cmdClient_OnClick()">
<input type="button" value="Add/Edit Product" name="cmdProduct" OnClick="cmdProduct_OnClick()" tabindex="8">
</form>
PRODUCT.asp -- onUnload function works
function onunload(){
if ("<%=intProjectID%>" != ""
{
objParentWindow = window.opener.parent.window;
objParentWindow.document.frmSales.txtProductID.value = "<%=intProductID%>";
objParentWindow.document.frmOpportunity.submit();
}
}
Called on
<body onunload="return window_onunload()">
CLIENT.asp --- onUnload function does not work.
function window_onunload()
{
if ("<%=intProjectID%>" != ""
{
objParentWindow = window.opener.parent.window;
objParentWindow.document.frmSales.txtClientID.value = "<%=intCompetitor%>";
objParentWindow.document.frmOpportunity.submit();
}
}
Called by
<body onunload="return window_onunload()">
To start, I am using IE 5.5 on a Windows 2000 machine.
Here is the problem:
I have two pop-up windows opened from another pop-up window (Product and Client are opened from Sales). The onUnload event on both Product and Client set hidden fields on Sales before closing the pop-up. The function on Product works (existing code, not written by me), and the code on Client doesn't. I keep getting "objParentWindow.document.frmSales.txtClientID is null or not an object." To me, they look exactly the same. Any ideas?
Here are the pertinent parts of the files:
SALES.asp
<script language="javascript">
function cmdProduct_OnClick()
{
strURL = "Product.asp?prodID=" + window.document.frmOpportunity.cboProduct.options[window.document.frmOpportunity.cboProduct.selectedIndex].value + "&ManufID=&CategoryID=&OppoID=<%=intOppoID%>&projid=<%=intProjectID%>&Source=<%=strSource%>";
window.open (strURL,'NewProduct','left=20,top=45,height=400,width=780,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,titlebar=yes')
}
function cmdClient_OnClick()
{
strURL = "Client.asp?contractorID=" + window.document.frmOpportunity.cboTileContractor.options[window.document.frmOpportunity.cboTileContractor.selectedIndex].value + "&OppoID=<%=intOppoID%>&projid=<%=intProjectID%>&Source=<%=strSource%>";
window.open (strURL,'Client','left=20,top=45,height=140,width=400,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,titlebar=yes')
}
</script>
...
<form name="frmSales" method="post" action="sales.asp">
<input type="hidden" name="txtClientID">
<input type="hidden" name="txtProductID">
...
<input type="button" value="Add/Edit Client" name="cmdClient" OnClick="cmdClient_OnClick()">
<input type="button" value="Add/Edit Product" name="cmdProduct" OnClick="cmdProduct_OnClick()" tabindex="8">
</form>
PRODUCT.asp -- onUnload function works
function onunload(){
if ("<%=intProjectID%>" != ""
objParentWindow = window.opener.parent.window;
objParentWindow.document.frmSales.txtProductID.value = "<%=intProductID%>";
objParentWindow.document.frmOpportunity.submit();
}
}
Called on
<body onunload="return window_onunload()">
CLIENT.asp --- onUnload function does not work.
function window_onunload()
{
if ("<%=intProjectID%>" != ""
objParentWindow = window.opener.parent.window;
objParentWindow.document.frmSales.txtClientID.value = "<%=intCompetitor%>";
objParentWindow.document.frmOpportunity.submit();
}
}
Called by
<body onunload="return window_onunload()">