473,503 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

closing a popup form

Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.asp x?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}
The screen opens fine. However, I can't get it to close after I the user
submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")

Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form, then a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS

Nov 18 '05 #1
4 2989

"SteveS" <ss*****@trendmls.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.asp x?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}
The screen opens fine. However, I can't get it to close after I the user
submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")

Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form, then a duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS

where is the form submitted ? if it is submitted to itself you are probably
seeing is close and then re-open again !

Nov 18 '05 #2
The popup form is submitted to itself through this button:

<asp:Button ID="btnSend" Runat="server" Text="Send Denial"></asp:Button>

Then, the click event in the code-behind sends the javascript to the page:

Private Sub btnSend_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSend.Click
...do stuff....
CloseWindow()
End Sub

Private Sub CloseWindow()
'Response.Write("<script
language='javascript'>window.close();</script>")
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.parent.close();window.close ();</script" & ">")
End Sub

So, do you think when a button is clicked on the popup form, it create
another browser window? How can I get around this?

"Zoe Brown" <zo*******@d-o-n-o-t-s-p-a-m-tfn.com> wrote in message
news:40********@primark.com...

"SteveS" <ss*****@trendmls.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.asp x?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}
The screen opens fine. However, I can't get it to close after I the user submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")

Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form,
then a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS

where is the form submitted ? if it is submitted to itself you are

probably seeing is close and then re-open again !


Nov 18 '05 #3
The popup form is submitted to itself through this button:

<asp:Button ID="btnSend" Runat="server" Text="Send Denial"></asp:Button>

Then, the click event in the code-behind sends the javascript to the page:

Private Sub btnSend_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSend.Click
...do stuff....
CloseWindow()
End Sub

Private Sub CloseWindow()
'Response.Write("<script
language='javascript'>window.close();</script>")
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.parent.close();window.close ();</script" & ">")
End Sub

So, do you think when a button is clicked on the popup form, it create
another browser window? How can I get around this?

"Zoe Brown" <zo*******@d-o-n-o-t-s-p-a-m-tfn.com> wrote in message
news:40********@primark.com...

"SteveS" <ss*****@trendmls.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.asp x?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}
The screen opens fine. However, I can't get it to close after I the user submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")

Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form,
then a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS

where is the form submitted ? if it is submitted to itself you are

probably seeing is close and then re-open again !


Nov 18 '05 #4
Hi

To prevent a new page opening set the base target in the dialog
<base target="_self">
http://msdn.microsoft.com/library/de...ies/target.asp

Or use a iframe in the dialog and host the page there

After a postback success return a script to close the dialog
<script>window.close();</script>

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
"SteveS" <ss*****@trendmls.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.asp x?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}
The screen opens fine. However, I can't get it to close after I the user
submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")

Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form, then
a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS

Nov 18 '05 #5

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

Similar topics

1
2438
by: MJEASSOC | last post by:
I need some help with closing a popup window. I'm making an online portfolio, that has one base page with text and thumbnails. When a user clicks on a thumb, a new window opens containing a larger...
4
2621
by: Ellen Manning | last post by:
Using A2K. I have a form that allows the user to print one or more reports. The user checks which report they want printed then they click on a button to start printing. A popup form displays...
4
5828
by: deko | last post by:
I have a pop-up form in which user-defined parameters are entered. The parameters are entered into a subform datasheet which is bound to a table. I need to check the product of two parameters to...
3
313
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
3
1715
by: thechaosengine | last post by:
Hi all, I need to be able to cause the following chain of events after clicking an asp:button but I don't know how to do it. I'd really appreciate any advice on this or alternative approaches: ...
4
2901
by: rdemyan | last post by:
I'm using code from the following web page to open the API Browse Folder dialog http://www.mvps.org/access/api/api0002.htm It all works fine. But if the dialog box is open and the user closes...
1
5154
by: Tyrone Slothrop | last post by:
Any idea of why this will not work? I have an image editor in a popup that is opened from a form in a window containing data as well as displaying images for the record. When the image has been...
4
8802
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
3
1923
by: =?Utf-8?B?Vk1J?= | last post by:
How can I close popup window automatically when I close the parent window (the application itself)? Thanks.
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
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...
0
7278
Oralloy
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,...
0
7328
jinu1996
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...
1
6988
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...
0
5578
agi2029
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,...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.