Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2004, 01:12 AM
Authorized User
 
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default preview pop-up window (solved)

hi

how do i code a preview pop-up window just like the one in this forums?

i have a form(form1) for the user to enter data, and a preview button in the same form

when the button is clicked, a javascript function, getData(), will get the data in form1 and store them in hidden fields in form2, and a pop-up window will display the data

i tried calling the preview function in the action attribute of form2, in the getData() function and in the preview button itself, but it dont seem to work. i viewed the source of this page but cant get any clues on how to make my preview work, any ideas people??
 
Old March 17th, 2004, 01:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

dhaywirex,

You will need to pass the form data to the popup window.
One way to do this is to create a query string in your javascript function and use that when calling the popup window



======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old March 17th, 2004, 03:25 AM
Authorized User
 
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi rod

thanks for your suggestion, query string works nicely, however, will it affect the performance if the query string is extremely long, since the data may contain lots and lots of text?
is there any other way to pass the info to the preview window?
i tried to post form2 to the preview window, however, the preview window will open up as a normal browser, instead the one in my preview function which has the status bar etc disabled, how how how???

 
Old March 17th, 2004, 03:34 AM
Authorized User
 
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

btw people,
how do i pass html tags into the query string, which is created in javascript

 
Old March 17th, 2004, 04:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Another way is to access the information directly from the "Parent" window. and place the values in a div tag
so if you had a couple of divs on the preview page
<div id="aDIV1"></div>

<div id="aDIV2"></div>

at the end of the page you can asign to each of the divs the value from the opener from

document.all['aDIV1'].innerHTML = window.opener.window.form2.YOURCONTROLNAME.value;
document.all['aDIV2'].innerHTML = window.opener.window.form2.YOUROTHERCONTROLNAME.va lue;

But with either of these i can not see a need to
 
Quote:
quote:will get the data in form1 and store them in hidden fields in form2

Your getData() function can just open the window in whatever style you like then the js can fill in the blanks.

Im not sure what you mean by
Quote:
quote:pass html tags into the query string
But if the tags are part of YOURCONTROLNAME then they will become part of the div as well rendered as they should in html.




======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old March 17th, 2004, 04:24 AM
Authorized User
 
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ooooo great the 2nd method solves all my problems, thanks alot rod

anyway, what i mean by passing the html tags is er...cause if i use the query string method, the preview window works as well, but if my original data contains some html tags(cause i have a html editor for the data field, like some forums), then the preview window wouldnt display the data, so i thought its because the html tags in the data got lost somewhere in the query string or what.

anyhow, accessing the information directly solves everything, thnks once again

 
Old March 17th, 2004, 04:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I see,
For reference you can encode data to be passed as a querystring with... server.htmlencode(stringinfo) [u]I think</u>



======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Window refresh and window pop up in Java Script Aleksandra Javascript How-To 2 March 2nd, 2007 06:47 PM
pop-up window rajiv_software Classic ASP Basics 1 April 12th, 2005 06:11 AM
pop up window sankar VB How-To 0 July 29th, 2003 01:29 AM
Post Preview Window Placement SerranoG Forum and Wrox.com Feedback 1 June 13th, 2003 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.