Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Popup Window from JSP

 
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.
 
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 ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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 VI Editor Ubuntu
  • 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
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this has clearly become about HTML and Javascript. moved to that forum.
 
author
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 ..
 
    Bookmark Topic Watch Topic
  • New Topic