Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > Program Design and Methods
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 01-28-2007, 07:56 PM   #1 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
how to populate parent window from child window usin coldfusion

hey guyz.....how do i populate parent window from child window ........

lets say.....my parent window is

Quote:
<div align="left"><strong>search or <a href="javascriptpenpopup('example.html')">finite </a> </strong><form>
<strong>From:</strong>
<input type="text" id="textField">
</form>
<div id="contentArea"></div></div>
and my child window has a href link it....so what should i do to populate teh parent window when i click the href link in child window......i would appreciate any kinda help or suggestions guyz....thanx....
__________________
daraptor is offline   Reply With Quote
Old 01-29-2007, 07:19 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
You said it yourself: parent.<whatever>
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 01-29-2007, 09:09 AM   #3 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by redhead View Post
You said it yourself: parent.<whatever>
i dint get u man...could u be more specific....thanx.....
__________________
daraptor is offline   Reply With Quote
Old 01-29-2007, 12:52 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
i think parent will refer to itself at the window level. there is a member named opener that will reference the window that launched the popup.

example: main.html
HTML Code:
<html> <body> <a href="popup.html" target="_blank">Open Popup</a> </body> </html>
popup.html
HTML Code:
<html> <head> <script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; } </script> <body> <a href="javascript:javascriptpenpopup('http://codenewbie.com/forum/');">Code Newbie</a><br /> <a href="javascript:javascriptpenpopup('http://php.net/');">PHP</a><br /> <a href="javascript:javascriptpenpopup('http://google.com/');">Google</a> </body> </html>
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-29-2007, 06:13 PM   #5 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
i think parent will refer to itself at the window level. there is a member named opener that will reference the window that launched the popup.

example: main.html
HTML Code:
<html> <body> <a href="popup.html" target="_blank">Open Popup</a> </body> </html>
popup.html
HTML Code:
<html> <head> <script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; } </script> <body> <a href="javascript:javascriptpenpopup('http://codenewbie.com/forum/');">Code Newbie</a><br /> <a href="javascript:javascriptpenpopup('http://php.net/');">PHP</a><br /> <a href="javascript:javascriptpenpopup('http://google.com/');">Google</a> </html>
hey buddy it is not workin man...do u know any other method to do that.......anyways thanx for the help
__________________
daraptor is offline   Reply With Quote
Old 01-29-2007, 07:33 PM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
not sure why, i tested that in IE7 and firefox.
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-30-2007, 05:26 AM   #7 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
not sure why, i tested that in IE7 and firefox.
hey man...do i need to replace those tagswith anything else......
__________________
daraptor is offline   Reply With Quote
Old 01-30-2007, 05:47 AM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
not sure why the forum is not recognizing my new spaces. it's purely html and javascript.. no cold fusion involved in this example.

it works for me as it is, so unless you are getting javascript errors or something, i really can't help.
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-30-2007, 06:31 AM   #9 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
not sure why the forum is not recognizing my new spaces. it's purely html and javascript.. no cold fusion involved in this example.

it works for me as it is, so unless you are getting javascript errors or something, i really can't help.
its not javascript error man....when i hit the hyperlink in child window....the parent window is refreshin and thats it .....the child window doesnt close......and it does not populate parent window...thanx man
__________________
daraptor is offline   Reply With Quote
Old 01-30-2007, 06:38 AM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
now we're getting somewhere. it helps when you give more info like that.

just add: window.close to the javascript function in the popup.
Code:
<script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; window.close(); } </script>
i'm not sure what you want to populate the parent window with if it is refreshing. explain
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-30-2007, 08:23 AM   #11 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
now we're getting somewhere. it helps when you give more info like that.

just add: window.close to the javascript function in the popup.
Code:
<script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; window.close(); } </script>
i'm not sure what you want to populate the parent window with if it is refreshing. explain
for example there is some airfare website...in that when we type in the airport code and hit search..we get the results...right...after that we search the required airport code and click on it right....then that airport code which we clickd goes and populates the main page text box where it is supposed to be...ok...u know waht i mean....i want a code for somethin like this.....when i hit a hyper text in child window......it should close and populate the text box in parent window....thanx man
__________________
daraptor is offline   Reply With Quote
Old 01-30-2007, 08:46 AM   #12 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
opener references the parent, so in your javascript you should be able to use that.

for example, if i wanted to assign a text field in the opener window from a text field in the popup, i would assign those fields ids and do something like this in the popup:
Code:
opener.getElementById('my_text_field').value = 'blah';
might need to make it opener.document.getElementById .. i haven't tested it.

report back what you find.
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-30-2007, 06:27 PM   #13 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
opener references the parent, so in your javascript you should be able to use that.

for example, if i wanted to assign a text field in the opener window from a text field in the popup, i would assign those fields ids and do something like this in the popup:
Code:
opener.getElementById('my_text_field').value = 'blah';
might need to make it opener.document.getElementById .. i haven't tested it.

report back what you find.
hey man this is my parent window.....

Quote:
<body>
<form id="form1" name="form1" method="post" action="">
<label for="textfield">example or <a href="child.cfm">instance</a> </label>
<input type="text" name="textfield" id="textfield" />
</form>
</body>
</html>
this is my child window....
Quote:
<body>
<p>this is child window.....with a href link by clickin it i want to populate the textbox in parent window....</p>
<p>results after search : </p>
<table width="200" border="1">
<tr>
<td width="63"><div align="center">XYZ</div></td>
<td width="86">ABC</td>
<td width="29">DEF</td>
</tr>
</table>
</body>
</html>
now in the parent window..you can see there is a texbox with hyperlink named instance or example.....that hyperlink when clicked will open a popup child window....

now in the child window....after performin the search...got the results a table with xyz,abc,def ok.....now...xyz should be a hyperlink....and when i click on xyz in the popup....the popup should close and i should see xyz in the parent text box......could this be possible....if so....can u plz make corrections to this example above and lemme know...plz man....thanx for the help......
__________________
daraptor is offline   Reply With Quote
Old 01-31-2007, 08:03 AM   #14 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
i don't see the javascript code. what were the results of my last suggestion? i like to help, but it's nice to see people helping themselves with the info i provide too.
__________________
testing 1 2 3
sde is online now   Reply With Quote
Old 01-31-2007, 01:52 PM   #15 (permalink)
daraptor
Recruit
 
Join Date: Dec 2006
Posts: 14
daraptor is on a distinguished road
Quote:
Originally Posted by sde View Post
i don't see the javascript code. what were the results of my last suggestion? i like to help, but it's nice to see people helping themselves with the info i provide too.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; window.close(); opener.getElementById('textfield').value = '#post.id#'; } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <body> <form id="form1" name="form1" method="post" action=""> <label for="textfield">example or <a href="javascript:javascriptpenpopup('child.cfm');">child</a><br /> </label> <input type="text" name="textfield" id="textfield" /> </form> </body> </html> </body> </html>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="JavaScript" type="text/javascript"> function javascriptpenpopup(url) { window.opener.location.href = url; window.close(); } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <body> <p>this is child window.....with a href link by clickin it i want to populate the textbox in parent window....</p> <p>results after search : </p> <table width="200" border="1"> <tr> <td width="63"><div align="center"><a href="index.html">XYZ</a></div></td> <td width="86">ABC</td> <td width="29">DEF</td> </tr> </table> </body> </html> </body> </html>
this is how it looks man......when i try and hit the xyz in child window....the popup is closin.....but it is not populatin the parent window.....should i add anythin else to this thing........
__________________
daraptor is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
maintaining child relation between pages sde HTML, XML, Javascript, AJAX 1 05-25-2005 11:09 PM
OpenGL.dll Mr.Anderson Platform/API C++ 3 08-13-2004 10:07 AM


All times are GMT -8. The time now is 07:13 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle