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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you, Mark. These are excellent suggestions. Option one should do nicely. -Dave On Nov 20, 4:52 pm, Mark Reginald James <m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote:> 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. > > -- > We develop, watch us RoR, in numbers too big to ignore.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---