Updating Parent TextBox from Child Popup Window

J

Jason Wilson

I am trying to create a popup window that will give a user the option
to lookup a value and return it to a textbox on the parent page.

Here is my relevant code:

Code on Parent

<form id="frmCoding" action="CodeView.aspx" method="post"
runat="server">
...
CPT1<asp:Textbox ID="txtCPT1" runat="server" Width="240px" />
<input ID="butLookupCPT1" type="button"

style="color:#003399;font-family:Arial;font-weight:bold;"
onclick="javascript:LaunchCPTLookup();" value="?" />
...
<script type="text/javascript">
function LaunchCPTLookup(){
window.open("CPTLookup.aspx", "CPTLookup");
}
</script>

Code on Child

<form id="frmTest" name="frmTest">
<input type="text" name="txtTest" />
<input type="button" onclick="Test();" value="Test" />
</form>

<script type="text/javascript">
function Test(){
if (window.opener && !window.opener.closed)
window.opener.document.frmCoding.txtCPT1.Value =
document.frmTest.txtTest.Value;
window.close();
}
</script>

I don't get any errors on the child, but when I enter a value and click
the button the window closes but nothing changes on the parent.

Help?
 
D

Daniel

simple: change the property reference to value instead of Value on both


window.opener.document.frmCoding.txtCPT1.value =
document.frmTest.txtTest.value;

Have a great day!

- Danny
 
J

Jason Wilson

Gotta luv case sensitivity

simple: change the property reference to value instead of Value on both


window.opener.document.frmCoding.txtCPT1.value =
document.frmTest.txtTest.value;

Have a great day!

- Danny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top