|
 |
|
 |
 |
|
01-28-2007, 07:56 PM
|
#1 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
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....
__________________
|
|
|
01-29-2007, 07:19 AM
|
#2 (permalink)
|
|
Newbie
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
|
You said it yourself: parent.<whatever>
|
|
|
01-29-2007, 09:09 AM
|
#3 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by redhead
You said it yourself: parent.<whatever>
|
i dint get u man...could u be more specific....thanx.....
__________________
|
|
|
01-29-2007, 12:52 PM
|
#4 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
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
|
|
|
01-29-2007, 06:13 PM
|
#5 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
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
__________________
|
|
|
01-29-2007, 07:33 PM
|
#6 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
not sure why, i tested that in IE7 and firefox.
__________________
testing 1 2 3
|
|
|
01-30-2007, 05:26 AM
|
#7 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
not sure why, i tested that in IE7 and firefox.
|
hey man...do i need to replace those tagswith anything else......
__________________
|
|
|
01-30-2007, 05:47 AM
|
#8 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
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
|
|
|
01-30-2007, 06:31 AM
|
#9 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
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
__________________
|
|
|
01-30-2007, 06:38 AM
|
#10 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
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
|
|
|
01-30-2007, 08:23 AM
|
#11 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
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
__________________
|
|
|
01-30-2007, 08:46 AM
|
#12 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
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
|
|
|
01-30-2007, 06:27 PM
|
#13 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
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......
__________________
|
|
|
01-31-2007, 08:03 AM
|
#14 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,397
|
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
|
|
|
01-31-2007, 01:52 PM
|
#15 (permalink)
|
|
Recruit
Join Date: Dec 2006
Posts: 14
|
Quote:
Originally Posted by sde
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........
__________________
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -8. The time now is 07:13 PM.
|
Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle
|
 |
|