 |
| ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP Forms 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
|
|
|
|

June 17th, 2004, 09:20 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Opening a Pop-up window with Response.Redirect
Hi, I'm trying to open a popup window once a form has been submitted. I tried using Response.Redirect, but couldn't figure it out. So I went with the Response.Write object. It does work and opens the page in a pop up.,BUT the page containing the form refreshes to the asp page that "treats" the data in that form.<gr!>
Here's the code in question:
response.write("<scr" & "ipt>" & vbCrLf)
response.write("open(""submitted_fr.asp"",""ThankY ou"",""width=450,height=200,scrollbars=no, toolbars=no"");" & vbCrLf)
response.write("</scr" & "ipt>")
Can I have this page do two things: the Pop-up as scripted above AND close the page containing the code above, in other words close itself?
I'm thinking, is it possible to put a response.redirect() AND a response.write()in the same asp page? (the one treating the data)
I hope I'm clear,
Any help would greatly be appreciated,
Thanks
|
|

June 17th, 2004, 11:53 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Close a page and open a popup:
response.write "<script>"
response.write "open(""submitted_fr.asp"","ThankYou"",""width=450 ,height=200,scrollbars=no,toolbars=no"");"
response.write "window.opener=top;window.close();</script>"
HTH,
Snib
<><
|
|

June 17th, 2004, 12:18 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you Snib. But unfortunately, this didn't work either.
|
|

June 17th, 2004, 12:21 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Let me get this straight... you want to open a window when a form submits, and then close the window that the form was in?
Or do you want to open a window when you submit the form, and then cancel the form submit?
You need to give a few more details....
I hope you problem is soon resolved,
Snib
<><
|
|

June 17th, 2004, 12:32 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Basically my form fields write to an email.
The asp script that does this is in "get_fr.asp"
Something to this effect: <FORM ACTION="get_fr.asp"...>
In get_fr.asp, I also request to "redirect" the user to a Thank you page that I want in a pop-up.
So far all of this works BUT the get_fr.asp displays in its own window too, and of course, there's nothing in it.
If I include self.close() , in get_fr.asp: It prompts an alert type message notifying the user that this window has been requested to close. BUT that window shouldn't have been created to begin with. It's only the asp that treats the form.
Id this a lil' clearer?
|
|

November 4th, 2004, 04:09 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, I still haven't found a solution to this problem ;-(
Brief:
I have a form that writes to an HTML email, using ASP as the instruction page. (I called this page "get.asp") "get.asp" also prompts a "Thank you for ..." - Pop-up window, that when closed redirects to another website.
The instructions in question are called via the Form's action="get.asp", as mentioned above. When all is said and done, that "get.asp" page is in its own browser window with of course nothing in it.
How do I get rid of it?
Thanks for all your help,
nancy
|
|

November 4th, 2004, 06:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Nancy,
This thread might help you in a way.
how do I close a web browser using vb script?
But If I am right, you are looking for something like, when the the job is done on get.asp, it pops up a window to say "thank you and stuff" and when the popped up window is closed the parent window, which already had displayed get.asp, should be refreshed with some other URL. Is that what you are looking for?
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

November 5th, 2004, 11:09 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
YES, Vijay, that's exactly what I want!
Would you like to see my code in get.asp?
|
|

November 9th, 2004, 09:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Nancy,
Sorry about the delayed response.
Try this. Just create 2 new pages and paste the corresponding code given below in each. Test these out and make the changes in you setup accordingly.
MainWindow.asp
Code:
<html>
<head>
<title>POPUP</title>
<script language="JavaScript" type="text/javascript">
function openWindow(url)
{
popupWin = window.open(url,'popup','width=300,height=300')
}
</script>
</head>
<body>
<% response.write now() %>
<br>
<a href = "Javascript:openWindow('popup.asp');">Click here</a>
</body>
</html>
popup.asp
Code:
<html>
<head>
<title>POPUP</title>
</head>
<body onLoad="window.focus();">
<a href="JavaScript:onClick=self.opener.location='SOMEPAGE.ASP';window.close()">Close Window</a>
</body>
</html>
Replace SOMEPAGE.ASP with some other URL (may be the exact URL you wanted to refresh that page with)
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|
 |