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

access the window created by target property of form 1

Status
Not open for further replies.

earme

Programmer
Jul 27, 2000
155
US
Hello,

I have the following form declaration:

<form METHOD=&quot;POST&quot; action&quot;inven.asp&quot; id=&quot;inventory&quot; name=&quot;inventory&quot; onSubmit=&quot;checkWindow();&quot; target=&quot;report&quot;>

What I want checkWindow() to check if the target window has already been opened, which means the submit button has already been pushed, and then close that window (I know that the window will just get created again, but I need the window to close before submitting again).
However, I'm not sure how to check if the window's open.
Can someone help?

Thanks!
Earme
 
----------------------------------------
From thread 216-78493:

<form onsubmit=&quot;x=parent.hiddenframe.open('notify.htm')&quot; action=&quot;myformpage.asp&quot;>

then in the myformpage.asp:

<body onload=&quot;if(!parent.hiddenframe.x.closed){x.close()}&quot;
----------------------------------------

Ok, if I understand that code correctly it does the following:
When the form is submitted it opens notify.htm from the hidden frame and submits the form to myformpage.asp in the original window.
Then, when myformpage.asp is loaded it closes the window with notify.htm.
Right?

If that is right, then it's not quite what I want it to do, or I'm missing the point (in which case could someone explain that code to me?).
I want the form submitted to a new window called report, and the page with the form will stay the same. If the user changes the form's inputs and resubmits I want the previously opened window, report, to close before it opens again.

I know it's screwy, but the report window is has a Crystal Report in it using an ActiveX component, that causes an error if I try to load another report into it, but if I close the window first, it works fine. But I don't know how to get the handle of the window to close it.

Earme
 
Well, the thread was only to illustrate the point on how to detect if a window was open --

use an onClick function for your submit button that will first check if:

window.closed

you'll have to have some sort of id attached to it so that you will be able to refer to it, and control it.

if it's not opened, then open it -- and if it is opened, then close it, and then open another -- yes?
 
[ignore]Thanks for being patient with me link9!

It's working wonderfully now.

Thanks again!

Earme
[/ignore]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top