aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Popup Window from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Popup Window from JSP" Watch "Popup Window from JSP" New topic
Author

Popup Window from JSP

Snehal Kamble
Greenhorn

Joined: Mar 13, 2006
Posts: 7
I have a JSP i.e. parent window with a hyperlink . On click of the hyperlink i call a javascript to call popup window .
window.open("login.do","PopUp");
The login.do struts path on success calls Popup.jsp. There is a text field on Popup.jsp the value of the text field i want on parent window in some hidden field.
How do i do that ?
I tried using opener.document.<form name>.<text field>.value
but it doesn't work.
The form on parent window is undefined.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Welcome to JavaRanch Snehal


Originally posted by Snehal Kamble:

The form on parent window is undefined.


What do you means by this? Are you getting this error?
[ March 13, 2006: Message edited by: Chetan Parekh ]

My blood is tested +ve for Java.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Can you pass the value of the textbox as a request parameter ?
window.open("login.do?text=value","PopUp");


[My Blog]
All roads lead to JavaRanch
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Satou kurinosuke:
Can you pass the value of the textbox as a request parameter ?
window.open("login.do?text=value","PopUp");


Hey Satou,actually he needs values from child window (popup) to the parent window - not the opposite one.
Snehal Kamble
Greenhorn

Joined: Mar 13, 2006
Posts: 7
right .. i require values from popup window to parent window .
if i do alert(window.opener) on Popup.jsp it is shown as undefined.
Hence javascript in Popup.jsp
function setValue(val)
{
window.opener.document.PARENT_FORM.parentfield.value=val;
window.close();
}
doesn't work..
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

actually he needs values from child window (popup) to the parent window

oops
[ March 13, 2006: Message edited by: Satou kurinosuke ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you try with self.opener ?
Snehal Kamble
Greenhorn

Joined: Mar 13, 2006
Posts: 7
tried with self.opener also but doesn't help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

As this has clearly become about HTML and Javascript. moved to that forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you need to return false on the onclick of the hyperlink

onclick="functionName();return false;"

When you do that, it should work.

Eric
Snehal Kamble
Greenhorn

Joined: Mar 13, 2006
Posts: 7
thanks.. its working ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Popup Window from JSP