# Popup hell - submit & close

**URL:** <https://www.ruby-forum.com/t/popup-hell-submit-close/93135>\
**Category:** Rails\
**Created:** [April 28, 2007, 1:11am UTC](https://www.ruby-forum.com/t/popup-hell-submit-close/93135 "2007-04-28T01:11:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [April 28, 2007, 1:11am UTC](https://www.ruby-forum.com/t/popup-hell-submit-close/93135/1 "2007-04-28T01:11:53Z")

</div>

Hi:

I’ve created a popup I’m desperately trying to close. It’s just not  
working. I’ve got a simple form\_for with a submit tag. I put in an  
onclick method and that’s not doing it. Can anyone help?

Here’s the submit\_tag:

\<%= submit\_tag “Send!”, :onclick =\> “javascript: window.close();” %\>

When I do this, the submit method fires and my DB is updated fine, but  
the close never happens.

Then, after the db insert, I get a message:

Missing template ./script/…/config/…/app/views/tasks/create.rhtml

Can anyone explain what’s going on?

Thanks so much in advance!

Mike

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [April 28, 2007, 2:54pm UTC](https://www.ruby-forum.com/t/popup-hell-submit-close/93135/2 "2007-04-28T14:54:06Z")

</div>

Can anyone help on this one?

Thanks!

Mike

Mike D. wrote:

> Hi:
> 
> I’ve created a popup I’m desperately trying to close. It’s just not  
> working. I’ve got a simple form\_for with a submit tag. I put in an  
> onclick method and that’s not doing it. Can anyone help?
> 
> Here’s the submit\_tag:
> 
> \<%= submit\_tag “Send!”, :onclick =\> “javascript: window.close();” %\>
> 
> When I do this, the submit method fires and my DB is updated fine, but  
> the close never happens.
> 
> Then, after the db insert, I get a message:
> 
> Missing template ./script/…/config/…/app/views/tasks/create.rhtml
> 
> Can anyone explain what’s going on?
> 
> Thanks so much in advance!
> 
> Mike

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [April 28, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/popup-hell-submit-close/93135/3 "2007-04-28T16:15:25Z")

</div>

Maybe this is the case. You click the submit button, it bring you to  
the new page. So the javascript does not work because you are already  
in new page. You should put window.close function in the new page  
(your missing template).

On Apr 28, 6:11 am, Mike D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [April 28, 2007, 7:11pm UTC](https://www.ruby-forum.com/t/popup-hell-submit-close/93135/4 "2007-04-28T19:11:37Z")

</div>

Instead of using a popup window, how about something a little more  
slick?

[http://sublog.subimage.com/articles/category/submodal](http://sublog.subimage.com/articles/category/submodal)

It’s designed for such situations as yours 😉

On 4/28/07, rinda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > –  
> > Posted viahttp://www.ruby-forum.com/.
> 
> >

## –

## seth at subimage interactive

## [http://www.subimage.com](http://www.subimage.com) [http://sublog.subimage.com](http://sublog.subimage.com)

> **[Freelance Time Tracking Software — Online Invoice Software](https://cashboardapp.com/)**
>
> Freelance time tracking software, online invoice software & project management.
> Used by thousands worldwide since 2007. FREE trial.

[http://dev.subimage.com/projects/substruct](http://dev.subimage.com/projects/substruct)
