954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Close Pop up window when cancel on dialog box is pressed

Hello

I have a jsp on which there is a table and a hyperlink to Export the same table into excel sheet. According to the functionality, it is required that on clicking Export, a blank pop up without address bar and other toolbars will be opened and on that empty pop up, the dialog box for Open, Save or Cancel Excel file will come.

Now, if the user clicks on open, the excel file opens in the pop up. But if user clicks on either save or cancel, in the both cases, the blank pop up remains opened. Please suggest the ways to close it automatically when save or cancel is clicked.

Thanks

adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

Can't u just use dispose() or hide() methods of Popup ??

diasmvds
Newbie Poster
9 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.

What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?

loken
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

Try combining dispose() or exit() with the window...you could also pass a variable false to set the pop-ups visibility.

What is your code? You could also set your pop-up as listener for an close event. Did you try that one too?

I do not have any BODY in the pop up because the page that is going to be loaded on that pop up is in excel format. Therefore I don't know where to place the code to close unused pop up.

If the user clicks on Open, then only the jsp will be loaded in the excel format on that pop up, else in case of Save and Cancel, the pop up will remain without Body. That is why I could not provide any code for that.

I want to know, can something be done in the opener of that pop up?

Same problem was present in Google Analytics, but here on clicking on Export, a new Browser window is opened, not any pop up.

Thanks

adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

you usually place disposer() and flush() codes on events such as windowclose,windowopen and etc....

if you wish to open a popup when you click on export, you can simply call yourpopupid.open() method...
or is that what you intend to do?

loken
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

similarly you can call the dispose() or flush() or even setVisible(false) method on the click event for the cancel button. that way the popup should close.

loken
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 
similarly you can call the dispose() or flush() or even setVisible(false) method on the click event for the cancel button. that way the popup should close.

My Dear Loken, those Cancel, Save and Open buttons are of windows dialog box, not of any which I am creating.

Let me explain. Assume X.jsp is a page on which a link Export is present. On clickicking it, a new Pop up is opened which DOES NOT have any body. A new page called Y.jsp will be loaded on this pop up in Excel Format. In Y.jsp I am usingcontentType="application/vnd.ms-excel; charset=UTF-8" in Y.jsp, that is why I cannot place any javascript code on Y.jsp.

I have attached the view of Dialog Box. If Open is pressed, Y.jsp will be loaded on EMPTY pop up, else, the pop up will be there without any body.

Attachments DialogBox.bmp (342.11KB)
adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

ok, seems I must have misunderstood you...sorry about that...

this is how I would normally handle closing..
method onCancel
{
this.setVsible(false);
this.dispose();
}

I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...

loken
Light Poster
29 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

ok, seems I must have misunderstood you...sorry about that...

this is how I would normally handle closing.. method onCancel { this.setVsible(false); this.dispose(); }

I haven't check it with this sort of pop-ups so I might have to check more about this...I'll update you with my output...

Thanks Loken, I will try this code. But I have confusions.
- Do have to place this code snippet in the JSP which will be loaded as excel file?
- Does this onCancel function needs any input parameters? Because how onCancel() will know that Cancel or Save is pressed?
- Javascript function in an excel file... Believe me.... I am surprised.

adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

Hi Loken

Sorry to say, that method onCancel didnt work. We have to think more on that.

adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

We can take an example here:

<a href="/contextPath/Document.doc" target="_blank">
<img border="0" src="image1.PNG" width=20 height=20>
</a>


So a new blank window will be opened when user clicks on the image image1.png. Also a dialog box will come to open, save or cancel for Document.doc. I want to close this automatically when cancel or save is pressed. The _blank window does not have any body.

adityam4444
Newbie Poster
10 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You