Closing the pop-up window after submitting the form

Hi all,
I am poping up a window by
<%= link_to(image_tag(…), :action =>“sample”, :popup =>
[‘new_window’]) %> as I want the action “sample” to be performed and the
result should be displayed in the pop up. In the pop up window
say,“sample.rhtml”, I have one submit button. I want this pop up to be
automatically close after submitting the form’s text value to another
action. I have tried “onsubmit” in start_form_tag and form_remote_tag.
But its not working.Please help.