473,386 Members | 1,644 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,386 software developers and data experts.

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 2975

"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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.