You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bhaarat Sharma <bh...@gmail.com> on 2008/03/08 17:56:23 UTC

Struts1 - how to reload parent window from popup

Hello

I am wondering if there is anyway to reload a parent window from the
popup window.

Basically I have a parent window that has a 'Add Contact' link up top
and then list of added contacts.  When user clicks the addcontact info
a popup window is opened where users enter information and click add.
Upon clicking Add in the popup window the popup window disappears but
user has to manually refresh the parent window in order to see the
added information.  I am wondering if there is any way to do this via
javascript where everytimg the popup window is closed the parent
window is reloaded.

I visited some javascript forums regarding this issue but they are
saying to directly to the popup window like this
function openPopup() {
windowReference = window.open('/addContactInformationPopup.do','windowName');
if (!windowReference.opener)
windowReference.opener = self;
}

However, in my struts1 code i need to pass parameters as well.  So
link on my parent window that opens the popup window looks like this.

<html:link page="/addContactInformationPopup.do"
				name="paramsName" scope="page"
				target="_blank">Add Contact</html:link>

I'd appreciate any help.

thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Re: Struts1 - how to reload parent window from popup

Posted by not <ei...@milinovsky.at>.


newton.dave wrote:
> 
> --- Martin Gainty <mg...@hotmail.com> wrote:
>> use javascript
>> javascript:history.back();
> 
> I don't believe that would submit the form in the parent window, and I
> don't
> think the window that popped up would have a history anyway, no?
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

With window.opener you ge ta handle to the parent-window. To submit / reload
the form in the parent and close the child do something like this:

var parentWindow = window.opener;
parentWindow.document.forms[0].action=url; /* Whatever the action will be or
leave it as it is */
parentWindow.document.forms[0].submit();
parentWindow.focus();
window.close();	

-- 
View this message in context: http://www.nabble.com/Struts1---how-to-reload-parent-window-from-popup-tp15917342p19370582.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: Struts1 - how to reload parent window from popup

Posted by Dave Newton <ne...@yahoo.com>.
--- Martin Gainty <mg...@hotmail.com> wrote:
> use javascript
> javascript:history.back();

I don't believe that would submit the form in the parent window, and I don't
think the window that popped up would have a history anyway, no?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts1 - how to reload parent window from popup

Posted by Martin Gainty <mg...@hotmail.com>.
use javascript
javascript:history.back();

?
Martin
----- Original Message -----
From: "bhaarat Sharma" <bh...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Saturday, March 08, 2008 12:08 PM
Subject: Re: Struts1 - how to reload parent window from popup


> I am trying something like this
> function openPopup() {
> windowReference = window.open('<html:link
page="/addContactInformationPopup.do"
> name="paramsName" scope="page">','windowName');
> if (!windowReference.opener)
> windowReference.opener = self;
> }
>
> <a href="javascript:void(0);" onclick="javascript:openPopup(); return
> false;"> Add Contact</a>
>
> I cant JUST pass /addContactInformationPopup.do to the window.open
> because then the parameters arent passed to the popup window.
>
> But the above code is opening 2 windows...first one doesnt have passed
> parameters..second one does..
>
> On Sat, Mar 8, 2008 at 11:56 AM, bhaarat Sharma <bh...@gmail.com>
wrote:
> > Hello
> >
> >  I am wondering if there is anyway to reload a parent window from the
> >  popup window.
> >
> >  Basically I have a parent window that has a 'Add Contact' link up top
> >  and then list of added contacts.  When user clicks the addcontact info
> >  a popup window is opened where users enter information and click add.
> >  Upon clicking Add in the popup window the popup window disappears but
> >  user has to manually refresh the parent window in order to see the
> >  added information.  I am wondering if there is any way to do this via
> >  javascript where everytimg the popup window is closed the parent
> >  window is reloaded.
> >
> >  I visited some javascript forums regarding this issue but they are
> >  saying to directly to the popup window like this
> >  function openPopup() {
> >  windowReference =
window.open('/addContactInformationPopup.do','windowName');
> >  if (!windowReference.opener)
> >  windowReference.opener = self;
> >  }
> >
> >  However, in my struts1 code i need to pass parameters as well.  So
> >  link on my parent window that opens the popup window looks like this.
> >
> >  <html:link page="/addContactInformationPopup.do"
> >                                 name="paramsName" scope="page"
> >                                 target="_blank">Add Contact</html:link>
> >
> >  I'd appreciate any help.
> >
> >  thanks!
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: Struts1 - how to reload parent window from popup

Posted by Dave Newton <ne...@yahoo.com>.
Doesn't the popup get a reference to the opening window?

Seems like you could populate the form directly via the DOM and submit it the
same way.

Dave

--- bhaarat Sharma <bh...@gmail.com> wrote:

> I am trying something like this
> function openPopup() {
> windowReference = window.open('<html:link
> page="/addContactInformationPopup.do"
> 				name="paramsName" scope="page">','windowName');
> if (!windowReference.opener)
> windowReference.opener = self;
> }
> 
> <a href="javascript:void(0);" onclick="javascript:openPopup(); return
> false;"> Add Contact</a>
> 
> I cant JUST pass /addContactInformationPopup.do to the window.open
> because then the parameters arent passed to the popup window.
> 
> But the above code is opening 2 windows...first one doesnt have passed
> parameters..second one does..
> 
> On Sat, Mar 8, 2008 at 11:56 AM, bhaarat Sharma <bh...@gmail.com>
> wrote:
> > Hello
> >
> >  I am wondering if there is anyway to reload a parent window from the
> >  popup window.
> >
> >  Basically I have a parent window that has a 'Add Contact' link up top
> >  and then list of added contacts.  When user clicks the addcontact info
> >  a popup window is opened where users enter information and click add.
> >  Upon clicking Add in the popup window the popup window disappears but
> >  user has to manually refresh the parent window in order to see the
> >  added information.  I am wondering if there is any way to do this via
> >  javascript where everytimg the popup window is closed the parent
> >  window is reloaded.
> >
> >  I visited some javascript forums regarding this issue but they are
> >  saying to directly to the popup window like this
> >  function openPopup() {
> >  windowReference =
> window.open('/addContactInformationPopup.do','windowName');
> >  if (!windowReference.opener)
> >  windowReference.opener = self;
> >  }
> >
> >  However, in my struts1 code i need to pass parameters as well.  So
> >  link on my parent window that opens the popup window looks like this.
> >
> >  <html:link page="/addContactInformationPopup.do"
> >                                 name="paramsName" scope="page"
> >                                 target="_blank">Add Contact</html:link>
> >
> >  I'd appreciate any help.
> >
> >  thanks!
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts1 - how to reload parent window from popup

Posted by bhaarat Sharma <bh...@gmail.com>.
I am trying something like this
function openPopup() {
windowReference = window.open('<html:link page="/addContactInformationPopup.do"
				name="paramsName" scope="page">','windowName');
if (!windowReference.opener)
windowReference.opener = self;
}

<a href="javascript:void(0);" onclick="javascript:openPopup(); return
false;"> Add Contact</a>

I cant JUST pass /addContactInformationPopup.do to the window.open
because then the parameters arent passed to the popup window.

But the above code is opening 2 windows...first one doesnt have passed
parameters..second one does..

On Sat, Mar 8, 2008 at 11:56 AM, bhaarat Sharma <bh...@gmail.com> wrote:
> Hello
>
>  I am wondering if there is anyway to reload a parent window from the
>  popup window.
>
>  Basically I have a parent window that has a 'Add Contact' link up top
>  and then list of added contacts.  When user clicks the addcontact info
>  a popup window is opened where users enter information and click add.
>  Upon clicking Add in the popup window the popup window disappears but
>  user has to manually refresh the parent window in order to see the
>  added information.  I am wondering if there is any way to do this via
>  javascript where everytimg the popup window is closed the parent
>  window is reloaded.
>
>  I visited some javascript forums regarding this issue but they are
>  saying to directly to the popup window like this
>  function openPopup() {
>  windowReference = window.open('/addContactInformationPopup.do','windowName');
>  if (!windowReference.opener)
>  windowReference.opener = self;
>  }
>
>  However, in my struts1 code i need to pass parameters as well.  So
>  link on my parent window that opens the popup window looks like this.
>
>  <html:link page="/addContactInformationPopup.do"
>                                 name="paramsName" scope="page"
>                                 target="_blank">Add Contact</html:link>
>
>  I'd appreciate any help.
>
>  thanks!
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org