hi forum
i have read a lot of articles regarding passing data from popup to parent up but i m looking for the opposite
that is
from parent to popup window
pls help me in this regard
i have three input fields in parent window
and three in popup window
parent.htm -
-
<script language="JavaScript">
-
function newWindow(file,window)
-
{msgWindow=open(file,window,'scrollbars=yes,resizable=no,width=550,height=400');
-
if (msgWindow.opener == null) msgWindow.opener = self;
-
}
-
</script>
-
-
<input type="button" value="Search" onClick="newWindow('popup.htm','window2')">
-
-
<form name="inputform1" >
-
<table><tr><td>Stitching Number
-
</td>
-
<td><input type="text" name="txtasno" tabindex="1" size="20">
-
</td>
-
<td>Remarks
-
</td>
-
<td><input type="text" name="txtremarks" tabindex="5" size="20">
-
</td>
-
<td>Sales Person
-
</td>
-
<td><input type="text" name="txtsperson" tabindex="6" size="20">
-
</td>
-
</tr></table>
-
</form>
-
popup.htm -
<form name="outputform1" >
-
<table><tr><td>Stitching Number
-
</td>
-
<td><input type="text" name="txtasno" tabindex="1" size="20">
-
</td>
-
<td>Remarks
-
</td>
-
<td><input type="text" name="txtremarks" tabindex="5" size="20">
-
</td>
-
<td>Sales Person
-
</td>
-
<td><input type="text" name="txtsperson" tabindex="6" size="20">
-
</td>
-
</tr></table>
-
</form>
-
i hope there is a way to do this
smile always:)
anand
12 37746
How can you pass a value without submitting a form?
I mean, you should have button in the input form. Then you can modify the popup.htm as follows - <form name="outputform1" >
-
<table><tr><td>Stitching Number
-
</td>
-
<td><%=request.form("txtasno")%>
-
</td>
-
<td>Remarks
-
</td>
-
<td><%=request.form("txtremarks")%>
-
</td>
-
<td>Sales Person
-
</td>
-
<td><%=request.form("txtsperson")%>
-
</td>
-
</tr></table>
-
</form>
-
This may help you.
Thanks and regards,
Vikas
hi thanks and yes it was a mistake i made but then the problem is still the same
i need to solve the way to pass data from parent window to popup window
i have modified the code accordingly
What is the error message?
Regards,
Vikas
hi i dont know if this is going to helpyou or no, but this one is simple sending data from parent window to child window. hope this helps
Parent window 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>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>send data over child window</title>
-
<script language="javascript" type="text/javascript">
-
var winRef;
-
function open_win(){
-
winRef=window.open("child.htm");
-
}
-
-
function send_data(){
-
var g=document.getElementById("_text").value;
-
winRef.document.getElementById("_child").value=g;
-
}
-
</script>
-
</head>
-
-
<body>
-
-
<a href="javascript:void(0);" onclick="open_win();">open window</a><br />
-
<input type="text" name="_text" id="_text" /><br />
-
-
<a href="javascript:void(0);" onclick="send_data();">Send data</a>
-
</body>
-
</html>
-
Child Window 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>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>Untitled Document</title>
-
</head>
-
-
<body>
-
-
<input type="text" name="_child" id="_child" value=""/>
-
</body>
-
</html>
-
cheers !!
How can you pass a value without submitting a form?
I mean, you should have button in the input form. Then you can modify the popup.htm as follows...
You can pass values without submitting a form. The code you posted assumes the data was posted and just displays it using ASP. Since there are no input fields, there's no need for the form tag.
Also, don't forget to use code tags when posting code.
i have read a lot of articles regarding passing data from popup to parent up but i m looking for the opposite
that is from parent to popup window
realin has posted code which you should be able to adapt to your requirements. Remember though that the popup window will not be available immediately, so you will need something to trigger the passing of value, e.g. a button.
Finally, the language attribute of the script tag is deprecated - use type="text/javascript" instead.
hi realin
thanks for the help and yes it is working fine
only thing that i require more is that is it possible to open the new window and copy the data with only link click?
or i have to do it this way only?
thanks
anand
You can do that, but you will need to use a timeout to check for the existence of the window. When it's ready, you can pass the data. An alternative is to call the function in the parent from the popup body onload.
hi realin
thanks for the help and yes it is working fine
only thing that i require more is that is it possible to open the new window and copy the data with only link click?
or i have to do it this way only?
thanks
anand
hiya,
well i guess u can call the send_data() function inside the other, ofcourse u can use setTimeout() so as to avoid any sorta problem. But if also integrated a check for the child window, meaning if the child window doesnt exist, it will alert the user and then it won't try to transfer data. Look at the modified code, nevertheless the childwindow code remains the same. - <!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>
-
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
-
<title>send data over child window</title>
-
-
<script language="javascript" type="text/javascript">
-
-
var winRef;
-
-
function open_win(){
-
-
winRef=window.open("popup.htm");
-
send_data();
-
}
-
-
-
-
function send_data(){
-
if(winRef==null){
-
alert("Child window doesn't exist");
-
return false;
-
}
-
else{
-
var g=document.getElementById("_text").value;
-
-
winRef.document.getElementById("_child").value=g;
-
}
-
-
}
-
-
</script>
-
-
</head>
-
-
-
-
<body>
-
-
-
-
<a href="javascript:void(0);" onclick="open_win();">open new child window and send data</a><br />
-
-
<input type="text" name="_text" id="_text" /><br />
-
-
-
-
<!--<a href="javascript:void(0);" onclick="send_data();">Send data</a>-->
-
-
</body>
-
-
</html>
-
cheers !!
Hello Friends !!
I have read all the above posts and seems interesting.
I have one query for the above post.
you are passing values from parent to child window. and now i need to pass the same values that are used in above code to passed back to parent window in a new text box thru child window using a link on child windows elements.
Can anybody help me regarding this.
Thanks in advance.
Regards,
Sneha
Hi Sheha, welcome to Bytes.
Use window.opener to refer to the parent from the child window.
To open the child window this is the code used in parent window -
<form method=post action='' name=f1>
-
<table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
-
<td ><font size=2 face='Verdana'>Your Name</font><input type=text name='p_name' size='8'>
-
<a href="javascript:void(0);" NAME="My Window Name" title=" My title here "
-
onClick=window.open("child3.html","Ratting",
-
"width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>
-
-
</td></tr> </table></form>
-
Inside the Child window code is here -
<html>
-
<head>
-
-
<script langauge="javascript">
-
function post_value(){
-
opener.document.f1.p_name.value = document.frm.c_name.value;
-
self.close();
-
}
-
</script>
-
-
<title>(Type a title for your page here)</title>
-
</head>
-
-
-
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
-
-
<form name="frm" method=post action=''>
-
<table border=0 cellpadding=0 cellspacing=0 width=250>
-
-
-
<tr><td align="center"> Your name<input type="text" name="c_name" size=12 value=test> <input type=button value='Submit' onclick="post_value();">
-
</td></tr>
-
</table></form>
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Davey |
last post by:
I have a website which has a popup window (this only opens when the user
chooses to open it). In the popup window I have a <select> control which
lists a selection of "classes". Each class has a...
|
by: Peter |
last post by:
1) I have a C# web application and what I am trying to do is create a popup window from a link on the parent window
2) the popup window will have a button and when a user clicks on the button the...
|
by: Aaron |
last post by:
I am having a little difficulty with a relatively simple task.
I have a parent webform. I have a javascript attribute added to a button to
open a new window when clicked.
The user fills in a...
|
by: midnight_use_only |
last post by:
hi all,
quick question, how do you submit a form to a parent window from a
child popup window? i have the following and all online documentation
*suggests* that it should work but it does NOT:
...
|
by: pingalkar |
last post by:
Hi,
In my application, I call one popup winodow by using this link..
<a href="#" onClick="return showWindow('1','XYZ');">
<img src="images/magnifier.gif" ALT="Chemicals"...
|
by: backups2007 |
last post by:
What I want to do is be able to open a popup window that may pass data to different rows of textboxes of its parent window.
I want to pass data to different rows of textboxes and each row has a...
|
by: TurboRogue |
last post by:
So here's the basic premise:
I have an html page with a bunch of pictures (pic.html). All of the images are thumbnails of larger photos. I also have another html page which is a pop-up window...
|
by: Cessaar |
last post by:
Hi masters, (excuse my english)
I hope you could help me with this...
I´m working with visual studio 2005 on IE7 (I think this the origen of my problem because on IE6 worked fine)...and I'm...
|
by: perhapscwk |
last post by:
how to passing value from popup to the parent window as a variable
which I can access and process the variable(string) in parent window?
such as from popup page, we have var_from_popup="abc",...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |