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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up windows & passing values

Status
Not open for further replies.

angel07

Programmer
Apr 25, 2001
3
US
I'm currently amending an application to introduce a postcode lookup field using ASP & VBScript.
I've got a button on my NameAddress.asp and also a value for the current address. When I click the button I want a new page called Postcode.asp to pop up with the current address value taken over & also the postcode value.
I'll then do the postcode search in Postcode.asp to provide me with the list of results in hyper links. Then clicking the hyperlink will close the popup window (postcode.asp) and populate the NameAddress.asp.
I have the postcode lookup functionality, I'm just struggling with linking it all together.
 
Oke, this one is now 3 days open, and almost gone from my 20 article-page...


Ultra short version of nameaddress.asp (you expand it):

<form name=frm1 method=post action=postcode.asp>
<input type=text name=address>
<input type=text name=zip>
<input type=submit value=PushMe>


Hitting the submit button will call postcode.asp and send it the 2 fields of this example. In postcode.asp you request the values from NameAddress.asp:
cAddress = request.form(&quot;address&quot;)
cZip = request.form(&quot;zip&quot;)

You do your search and build a list. Your link for each line is a variation of:

<a href=&quot;nameaddress.asp?address=NL&zip=1234ZX>Address 1</a>

So you call nameaddress.asp with a parameterlist.
nameaddress.asp should be clever enough to check if it was called with or without parameters; and use them.

Eg:

response.write &quot;<input type=text size=30 name=address&quot; &_
&quot;value='&quot; & request.querystring(&quot;address&quot;) & &quot;'>&quot;












br
Gerard
 
Check out the ShowModelessDialog method in DHTML

from MSDN (The Parent Window)
------------------------------------------------------------

<HEAD>
<HTML>
<HEAD>
<TITLE>showModelessDialogEX.htm</TITLE>
<SCRIPT>
var sUserName=&quot;&quot;;
/*------------------------------------------------------------
Supplying the window object as a parameter allows for declaring the global
variable, sUserName, and using it to return information from the modeless
dialog box.
------------------------------------------------------------- */
function fnCallDialog()
{
showModelessDialog(&quot;myDialog.htm&quot;,window,&quot;status:false;dialogWidth:300px;dialogHeight:300px&quot;);
}
/*-------------------------------------------------------------
The fnUpdate function takes the value passed into sUserName in myDialog.htm
to update the span text on this page. This function is called in both
fnGetInfo and fnCancel functions in myDialog.htm.
-------------------------------------------------------------*/
function fnUpdate()
{
oName.innerText = sUserName;
}
</SCRIPT>
</HEAD>
<BODY>
<P>Enter your first name: <SPAN ID=&quot;oName&quot;
STYLE=&quot;color:red;font-size:24&quot;>Joan</SPAN></P> <INPUT TYPE=&quot;button&quot;
VALUE=&quot;Display Modeless Dialog&quot; onclick=&quot;fnCallDialog()&quot;>
</BODY>
</HTML>

------------------------------------------------------------
In the above example they send &quot;window&quot; as vArgument which gives you access to the &quot;parent&quot; window so you can access/change any objects in the &quot;parent&quot; window.

From MSDN (The POPUP Window)
------------------------------------------------------------

<HTML>
<HEAD>
<TITLE>myDialog.htm</TITLE>
<SCRIPT>
/* -------------------------------------------------------------
This function makes use of the dialogArguments property of the
window object. dialogArguments allows the global variable sUserName
to feed the value supplied to the input in this dialog box back to
the window that called it.
---------------------------------------------------------------- */
function fnGetInfo()
{
var sData = dialogArguments;
sData.sUserName = oEnterName.value;
sData.fnUpdate();
}
/* -------------------------------------------------------------
This function cleans up in case the user has clicked the
Apply button before canceling.
---------------------------------------------------------------- */
function fnCancel()
{
var sData = dialogArguments;
sData.sUserName = &quot;Joan&quot;;
sData.fnUpdate();
}
</SCRIPT>
</HEAD>
<BODY>
<LABEL FOR=&quot;oEnterName&quot; ACCESSKEY=&quot;f&quot;>Enter your
<SPAN STYLE=&quot;text-decoration:underline&quot;>F</SPAN>irst Name</LABEL>
<INPUT ID=oEnterName><BR><BR>
<INPUT VALUE=&quot;Apply&quot; TYPE=button onclick=&quot;fnGetInfo();&quot;>
<INPUT VALUE=&quot;Ok&quot; TYPE=button onclick=&quot;fnGetInfo();window.close();&quot;>
<INPUT VALUE=&quot;Cancel&quot; TYPE=button onclick=&quot;fnCancel();window.close();&quot;>
</BODY>
</HTML>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top