• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Popup Window from JSP

 
Snehal Kamble
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you pass the value of the textbox as a request parameter ?
window.open("login.do?text=value","PopUp");
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually he needs values from child window (popup) to the parent window

oops
[ March 13, 2006: Message edited by: Satou kurinosuke ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try with self.opener ?
 
Snehal Kamble
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tried with self.opener also but doesn't help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this has clearly become about HTML and Javascript. moved to that forum.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.. its working ..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic