# Closing popup

**URL:** <https://www.ruby-forum.com/t/closing-popup/84207>\
**Category:** Rails\
**Created:** [February 2, 2007, 9:49am UTC](https://www.ruby-forum.com/t/closing-popup/84207 "2007-02-02T09:49:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 2, 2007, 9:49am UTC](https://www.ruby-forum.com/t/closing-popup/84207/1 "2007-02-02T09:49:40Z")

</div>

Hi,  
i’m using popup in my application when i have to use a form to submit  
some data:

link\_to “Add”, {:action =\> “add\_customer”}, :popup =\> [‘new’,  
‘height=300,width=300’]

When i push submit i like that the popup closes and refresh the main  
page that show the list of data.

thanks

claudio

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 2, 2007, 4:41pm UTC](https://www.ruby-forum.com/t/closing-popup/84207/2 "2007-02-02T16:41:48Z")

</div>

this is really a javascript question. off the cuff, what i would do  
is submit the form. if the form data was successfully processed, use  
some javascript to redirect the parent window to the location you want  
then close the child window. if it failed, just redisplay the form in  
the child window.

I’ll leave the implementation up to you.

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 2, 2007, 4:49pm UTC](https://www.ruby-forum.com/t/closing-popup/84207/3 "2007-02-02T16:49:20Z")

</div>

thanks  
claudio

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 14, 2007, 6:27am UTC](https://www.ruby-forum.com/t/closing-popup/84207/4 "2007-02-14T06:27:50Z")

</div>

hi,

I have to implement a similar functionality, how did you do it finally?

Claudio C. wrote:

> thanks  
> claudio

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 1, 2008, 5:45pm UTC](https://www.ruby-forum.com/t/closing-popup/84207/5 "2008-02-01T17:45:10Z")

</div>

Can someone help me also to work out this scenario…  
from a main window, i open a popup, then submit the popup, do some  
server side call, after this i close the popup window and now i need to  
update a DOM in my main window.  
How can i acheive this or should i be looking for any other way.

Thanks in advance  
Neha

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 2, 2008, 12:18am UTC](https://www.ruby-forum.com/t/closing-popup/84207/6 "2008-02-02T00:18:31Z")

</div>

Greg D. wrote:

> On 2/1/08, Neha C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Can someone help me also to work out this scenario…  
> > from a main window, i open a popup, then submit the popup, do some  
> > server side call, after this i close the popup window and now i need to  
> > update a DOM in my main window.  
> > How can i acheive this or should i be looking for any other way.
> 
> window.opener.location.reload();
> 
> –  
> Greg D.  
> [http://destiney.com/](http://destiney.com/)

The problem is i cant reload the whole of the main window, i just have  
to update a div.

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [February 2, 2008, 12:03am UTC](https://www.ruby-forum.com/t/closing-popup/84207/7 "2008-02-02T00:03:19Z")

</div>

On 2/1/08, Neha C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can someone help me also to work out this scenario…  
> from a main window, i open a popup, then submit the popup, do some  
> server side call, after this i close the popup window and now i need to  
> update a DOM in my main window.  
> How can i acheive this or should i be looking for any other way.

window.opener.location.reload();

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
