473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

passing variables between two different windows

Hello. I'm a rookie ASP VBScripter and am having a difficult time scripting
the following scenario:

I have an index.asp file that has a multi-line text box and a button of type
button. When the button is clicked a window is spawned with change.asp as
its source. There is a form with a few text boxes and with a button of type
submit and a cancel button of type button that just closes the window. What
I want to happen is I want the information entered in change.asp to be added
into the multi-line text box in index.asp when the submit button is clicked
in change.asp. Here are the index.asp and change.asp files:

//-----index.asp------------
<html>
<head>
<title>Product Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<script language="JavaScript" type="text/javascript">
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight );
function changeInfo()
{
var x = (screen.width - 400) / 2;
var y = (screen.height - 320) / 2;
var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
resizable=no, width=400, height=300, left="+x+" top="+y)
}
</script>

<body>
<table width="554" cellpadding="5">
<tr>
<td width="400"><img src="images/HouseValue 031.jpg" width="400"
height="300"></td>
<td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
<textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
wrap="soft" readonly>Press "Change" to enter information.</textarea>
<br>
<input type="button" value="Change" id="btnChange" name="btnChange"
onClick="javascript:changeInfo()">
</form></td>
</tr>
</table>
</body>
</html>
//-----------------------------------
//-------change.asp-----------------
<html>
<head>
<title>Edit Product Description</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/javascript">
function Cancel()
{
window.close();
}
</script>
<body>
<form name="frmChange" id="frmChange" method="post">
<table>
<tr>
<td align="right">Product Name:</td>
<td align="left"><input type="text" name="txtProduct" id="txtProduct"
size="40"></td>
</tr>
<tr>
<td align="right">Model #:</td>
<td align="left"><input type="text" name="txtModel" id="txtModel"
size="40"></td>
</tr>
<tr>
<td align="right">Value:</td>
<td align="left"><input type="text" name="txtValue" id="txtValue"></td>
</tr>
<tr>
<td align="right">Category:</td>
<td align="left"><select name="mnuCategory" id="mnuCategory">
<option selected value="NULL">Choose category...</option>
<option value="Furniture">Furniture</option>
<option value="Electronics">Electronics</option>
<option value="Home Media">Home Media</option>
<option value="Jewlery">Jewlery</option>
</select></td>
</tr>
<tr>
<td align="right" valign="top">Misc. Information:</td>
<td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
rows="5"></textarea></td>
</tr>
</table>
<br>
<center>
<input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
value="Submit">
<input type="button" name="btnCancel" id="btnCancel" value="Cancel"
onClick="javascript:Cancel()">
</center>
</form>
</body>
</html>
//-------------------------

I've been messing with it for a day now and I have been unable to pass
variables from change.asp into index.asp. Any help would be much
appreciated.

~Les Peabody
Nov 18 '05 #1
2 1783
Sounds like you'll be needing to use some client side javascript.
You can open a new window using javascript such as this:
a=window.open('MyPage.aspx','_new')
There are all kinds of options for setting window properties such as window
size and toolbar visibility.
Here's more info:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp

From that new window you can reference the original parent window with
this javascript reference:

Here's an example:
window.opener.document.form1.mytextbox.value = 'whatever';

Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref77.html

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Les Peabody" <le*********@geo-sync.com> wrote in message
news:eG**************@TK2MSFTNGP10.phx.gbl...
Hello. I'm a rookie ASP VBScripter and am having a difficult time scripting the following scenario:

I have an index.asp file that has a multi-line text box and a button of type button. When the button is clicked a window is spawned with change.asp as
its source. There is a form with a few text boxes and with a button of type submit and a cancel button of type button that just closes the window. What I want to happen is I want the information entered in change.asp to be added into the multi-line text box in index.asp when the submit button is clicked in change.asp. Here are the index.asp and change.asp files:

//-----index.asp------------
<html>
<head>
<title>Product Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<script language="JavaScript" type="text/javascript">
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight );
function changeInfo()
{
var x = (screen.width - 400) / 2;
var y = (screen.height - 320) / 2;
var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
resizable=no, width=400, height=300, left="+x+" top="+y)
}
</script>

<body>
<table width="554" cellpadding="5">
<tr>
<td width="400"><img src="images/HouseValue 031.jpg" width="400"
height="300"></td>
<td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
<textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
wrap="soft" readonly>Press "Change" to enter information.</textarea>
<br>
<input type="button" value="Change" id="btnChange" name="btnChange"
onClick="javascript:changeInfo()">
</form></td>
</tr>
</table>
</body>
</html>
//-----------------------------------
//-------change.asp-----------------
<html>
<head>
<title>Edit Product Description</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/javascript">
function Cancel()
{
window.close();
}
</script>
<body>
<form name="frmChange" id="frmChange" method="post">
<table>
<tr>
<td align="right">Product Name:</td>
<td align="left"><input type="text" name="txtProduct" id="txtProduct"
size="40"></td>
</tr>
<tr>
<td align="right">Model #:</td>
<td align="left"><input type="text" name="txtModel" id="txtModel"
size="40"></td>
</tr>
<tr>
<td align="right">Value:</td>
<td align="left"><input type="text" name="txtValue" id="txtValue"></td>
</tr>
<tr>
<td align="right">Category:</td>
<td align="left"><select name="mnuCategory" id="mnuCategory">
<option selected value="NULL">Choose category...</option>
<option value="Furniture">Furniture</option>
<option value="Electronics">Electronics</option>
<option value="Home Media">Home Media</option>
<option value="Jewlery">Jewlery</option>
</select></td>
</tr>
<tr>
<td align="right" valign="top">Misc. Information:</td>
<td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
rows="5"></textarea></td>
</tr>
</table>
<br>
<center>
<input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
value="Submit">
<input type="button" name="btnCancel" id="btnCancel" value="Cancel"
onClick="javascript:Cancel()">
</center>
</form>
</body>
</html>
//-------------------------

I've been messing with it for a day now and I have been unable to pass
variables from change.asp into index.asp. Any help would be much
appreciated.

~Les Peabody

Nov 18 '05 #2
That worked great, I figured there would be a way to access the parent
window. Thanks Steve.

~Les Peabody

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Sounds like you'll be needing to use some client side javascript.
You can open a new window using javascript such as this:
a=window.open('MyPage.aspx','_new')
There are all kinds of options for setting window properties such as window size and toolbar visibility.
Here's more info:
http://msdn.microsoft.com/workshop/a...ods/open_0.asp
From that new window you can reference the original parent window with
this javascript reference:

Here's an example:
window.opener.document.form1.mytextbox.value = 'whatever';

Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref77.html

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Les Peabody" <le*********@geo-sync.com> wrote in message
news:eG**************@TK2MSFTNGP10.phx.gbl...
Hello. I'm a rookie ASP VBScripter and am having a difficult time

scripting
the following scenario:

I have an index.asp file that has a multi-line text box and a button of

type
button. When the button is clicked a window is spawned with change.asp as its source. There is a form with a few text boxes and with a button of

type
submit and a cancel button of type button that just closes the window.

What
I want to happen is I want the information entered in change.asp to be

added
into the multi-line text box in index.asp when the submit button is

clicked
in change.asp. Here are the index.asp and change.asp files:

//-----index.asp------------
<html>
<head>
<title>Product Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<script language="JavaScript" type="text/javascript">
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight );
function changeInfo()
{
var x = (screen.width - 400) / 2;
var y = (screen.height - 320) / 2;
var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
resizable=no, width=400, height=300, left="+x+" top="+y)
}
</script>

<body>
<table width="554" cellpadding="5">
<tr>
<td width="400"><img src="images/HouseValue 031.jpg" width="400"
height="300"></td>
<td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
<textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
wrap="soft" readonly>Press "Change" to enter information.</textarea>
<br>
<input type="button" value="Change" id="btnChange" name="btnChange"
onClick="javascript:changeInfo()">
</form></td>
</tr>
</table>
</body>
</html>
//-----------------------------------
//-------change.asp-----------------
<html>
<head>
<title>Edit Product Description</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/javascript">
function Cancel()
{
window.close();
}
</script>
<body>
<form name="frmChange" id="frmChange" method="post">
<table>
<tr>
<td align="right">Product Name:</td>
<td align="left"><input type="text" name="txtProduct" id="txtProduct"
size="40"></td>
</tr>
<tr>
<td align="right">Model #:</td>
<td align="left"><input type="text" name="txtModel" id="txtModel"
size="40"></td>
</tr>
<tr>
<td align="right">Value:</td>
<td align="left"><input type="text" name="txtValue" id="txtValue"></td>
</tr>
<tr>
<td align="right">Category:</td>
<td align="left"><select name="mnuCategory" id="mnuCategory">
<option selected value="NULL">Choose category...</option>
<option value="Furniture">Furniture</option>
<option value="Electronics">Electronics</option>
<option value="Home Media">Home Media</option>
<option value="Jewlery">Jewlery</option>
</select></td>
</tr>
<tr>
<td align="right" valign="top">Misc. Information:</td>
<td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
rows="5"></textarea></td>
</tr>
</table>
<br>
<center>
<input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
value="Submit">
<input type="button" name="btnCancel" id="btnCancel" value="Cancel"
onClick="javascript:Cancel()">
</center>
</form>
</body>
</html>
//-------------------------

I've been messing with it for a day now and I have been unable to pass
variables from change.asp into index.asp. Any help would be much
appreciated.

~Les Peabody


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lawrence | last post by:
Those of you with backgrounds with the C language will laugh at my mistake, but those of you, like myself, who deal mostly with PHP should be warned about passing variables as references -...
2
by: Chieko Kuroda | last post by:
Hello all, I would like to learn the syntax for passing variables that I retreived from a database to a second asp page. Currently, I'm using: Response.Write "<tr><td>&nbsp;</td><td><Font size=...
1
by: Consuelo Guenther | last post by:
Hello, I am having problems with passing variables between pages. I have the following: First asp page has the function: -----------------------------------------------------------------------...
0
by: Chris Zoper | last post by:
Hello, I'd like to know how to exchange variables between different windows in a ASP.NET application. From my application I open a new window. Users can select some data in that new window and...
7
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass...
1
by: David Gaudine | last post by:
(This is a bit like the recent thread "PHP Switching Sessions".) I use session_start(). When I open my web-based application in two windows on the same system, there's a definite clash; I can't...
2
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
7
by: Cordouan | last post by:
I know this looks like it has been answered 1000 times but I have a slightly different problem. I am dealing with forms in order to populate a database. 2 windows : -Main window with my main...
6
by: coool | last post by:
Hi :) anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through...
6
BezerkRogue
by: BezerkRogue | last post by:
This is the most fundamental action I am sure, but I can't seem to make it happen. I am familiar with passing variables in ASP. But that doesn't seem to be the preferred method in .NET. I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.