getting form content for print popup

I'm trying to open a new window for printing a form from a link. I want
to display the contents of the form for printing. I can get the popup
to work, but am wondering how to get the contents of the form from the
parent window, using RJS.

I can use a submit option to get the form parameters in a
link_to_remote, but the popup doesn't work.

    <%= link_to_remote "Print", :url => {:controller =>
@controller_name, :action => 'print'},
                :submit => 'packing_items_form',
    :popup => ['new_window', 'menubar,resizable=true'] %>

Any suggestions?

Dave

Archer wrote:

I'm trying to open a new window for printing a form from a link. I want
to display the contents of the form for printing. I can get the popup
to work, but am wondering how to get the contents of the form from the
parent window, using RJS.

I can use a submit option to get the form parameters in a
link_to_remote, but the popup doesn't work.

    <%= link_to_remote "Print", :url => {:controller =>
@controller_name, :action => 'print'},
                :submit => 'packing_items_form',
    :popup => ['new_window', 'menubar,resizable=true'] %>

Any suggestions?

Some options:

1. Remove the :popup option and have your print action save your
    form params in the session and do a RJS "window.open" to a second
    action that generates the print HTML using these session params.

2. Make the Print link a link_to_function that adds the form parms
    to a print URL on which window.open is called. Hide the address
    bar to hide the ugly URL.

3. POST the form using a normal HTML form with target set to "_blank"
    and with a "Print" submit button (or onclick form.submit() link).
    If you have another submit button you can script a button-dependent
    setting of the form's target parameter.

Thank you, Mark. These are excellent suggestions. Option one should do
nicely.
-Dave