<p>I have a popup window containing a form which gathers data for a report.
When I click submit in that window, I want it to close the popup, and open the report in the original window that called the popup.</p>

<p>I think I can open the report in the correct window by using</p>

<pre><code>{ :target =&gt; &lt;name of window&gt; }
</code></pre>

<p>in the <code>form_tag</code>, but I don't know how to determine or set the name of the originating window.</p>

<p>I also don't know how to close the popup window.</p>

How is
this
for starters?
```
```
# The submit button in your child window's view:
<%= button_to_function 'Save', "$('my_form').submit(); window.opener.location.reload(); window.close();" %>
```
```