Forum Moderators: open
I have a pop-up window that populates the forum below. On my uploads.aspx page I have a form textbox called frmCategoryID. The popup called seecategories.aspx uses the following code to populate the field.
function SelectCat(categorycode) {
var txtarea = window.opener.document.forms[0].frmCategoryID;
txtarea.value = categorycode;
txtarea.focus();
self.close();
}
I have another page called default.aspx which also has a form textbox called frmCategoryID which is populated by the same seecategories.aspx page.
However, I get an error when I click to populate the default.aspx page. The error is:
'undefined' is null or not an object
Can someone please help.
Many Thanks
Helen.
I thought about nameing the form to "frmflipchart" and changing the javascript to read "window.opener.document.frmflipchart.frmCategoryID;" but this produces the error:
'window.opener.document.frmflipchart.frmCategoryID' is null or not an object
Helen.
By the way, names and ids aren't getting interchanged, by any chance?
I've changed the id attribute of the textbox to elID. It was frmCategoryID as I was already using id instead of name.
<asp:textbox id="elID" text='<%# Container.DataItem( "CategoryID" ) %>' runat="server" size="4" />
(
<a href="#" onClick="NewWin=window.open('seecategories.aspx', 'showwindow', 'toolbar=no,scrollbars=yes,status=no,width=500,height=350');">
see categories
</a>
)
I have changed the javascript to populate the field and it now reads
function SelectCat(categorycode) {
var txtarea = window.opener.document.getElementById("elId");
txtarea.value = categorycode;
txtarea.focus();
self.close();
}
However, I am now getting the "'null' is null or not an object" error message.
Thanks
Helen