Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open new window, choose radio, send val to orig. page text box??

Status
Not open for further replies.

cdgraphix

Programmer
Mar 12, 2002
5
US
Okay, I saw the perfect code to do this if they're on the same page, but...

I need to open a pop-up with a link,select one radio button, submit (closing the popup) and passing the value of the selected radio to automatically fill in a specific text box.

Any help would be greatly appreciated!!

Thanks.
 
Thanks, but I am a novice at JS... having object issues with the above, and also it needs to be submitted va the submit button, not directly on click.
I have this:
---Originating page---
<form name=&quot;myform&quot; action=&quot;actionpage.htm&quot;>
<p>
<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;20&quot; value=&quot;&quot;>
</p>
<p><a href=&quot;receive.htm&quot; target=&quot;_blank&quot;>click to open</a></p>
</form>

---Popup picker page---
<form>
<p><input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;20&quot;></p>
<p><input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V1&quot; onClick=&quot;opener.myform.t1.value=this.value&quot;>
<input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V2&quot; onClick=&quot;opener.myform.t1.value=this.value&quot;>
</p>
<input type=&quot;submit&quot;>
</form>

What is wrong with this picture?
Thanks in advance...
 
Javascript is case-sensitive, i.e. in Javascript
&quot;Hello&quot; is not equal &quot;hello&quot;
in your opener oage your field names are witha capital T i.e. name=&quot;T1&quot;
and in the pop-up page you refer to the as opener.myform.t1.value

so, change that to opener.myform.T1.value --------------------------------------------------
Goals are dreams with deadlines
 
Thanks for the tip (I am a CF coder - I forget about case-sensitivity), but it is still not the issue.
My code now reads:
---Originating page---
<form name=&quot;myform&quot; action=&quot;actionpage.htm&quot;>
<p>
<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;20&quot; value=&quot;&quot;>
</p>
<p><a href=&quot;receive.htm&quot; target=&quot;_blank&quot;>click to open</a></p>
</form>

---Popup picker page (receive.htm)---
<form>
<p><input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V1&quot;
onClick=&quot;opener.myform.T1.value=this.value&quot;>
<input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V2&quot;
onClick=&quot;opener.myform.T1.value=this.value&quot;>
</p>
<input type=&quot;submit&quot;>
</form>

I get the error 'opener.myform' is not an object.
So close, yet so far.... argh.
 
hmm,
try opener.document.myform.blah blah --------------------------------------------------
Goals are dreams with deadlines
 
Thanks, but no, it still doesn't like it.
Perhaps I should try to make a function in the header that the submit button calls??

As it is now:
Netscape tells me 'opener has no properties'
Explorer says 'opener.document is not an object'
 
Code:
opener
only exists in the window that was just opened using JavaScript. If you are dealing with a window that is not a popup,
Code:
opener
will simply return
Code:
null
.

Basically, put the code in the popup, not the window that opened it.
bluebrain.gif
blueuniment.gif
 
I had the code in the popup, but you made another great point that WORKS!! I was not opening the popup with javascript, only with a normal href with a target of _blank...

Thanks!!!
For others, final code:

---Originating page---
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function OpenWin(URL,Name,features) {
window.open(URL,Name,features);
}
//-->
</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form name=&quot;myform&quot;>
<p>
<input type=&quot;text&quot; name=&quot;T1&quot; size=&quot;20&quot; value=&quot;&quot;>
</p>
<p><a href=&quot;#&quot; onClick=&quot;OpenWin('receive.htm','top','width=210,height=100')&quot;>click to open</a></p>
</form>
</body>
</html>

---Receiving page (popup) with radio boxes----
<html>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form>
<p>
<input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V1&quot; onClick=&quot;opener.document.myform.T1.value=this.value&quot;>
<input type=&quot;radio&quot; name=&quot;R1&quot; value=&quot;V2&quot; onClick=&quot;opener.document.myform.T1.value=this.value&quot;>
</p>
</form>

</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top