tblack06 wrote:> Hello,
>
> I''m trying to use the rail link_to to open a popup window and then
> print the popup window at the same time. Is there a way to add
> another "onclick" option to tell the popup to print? I know how
to do
> this in javascript but not sure how to use the rails help to do it. I
> also am aware that the link_to_function method is used to call a
> javascript function. Here''s the code I have to open the popup:
>
> <%= link_to icon(''icon_printer'', :alt =>
''Print'') + ''Print Cable'',
> {:controller => ''print_popup'',
> :action => ''display_popup'',
> :doc => @document,
> :header => ''My Doc''},
> :title => ''My Title'',
> :popup =>
[''display_popup_to'',
> ''width=650,height=600,scrollbars=yes, menubar=1'']%>
Here is how I did mine:
<%=link_to_function "Print","window.print();" %>
But I had to fist generate the popup window using another link:
<%=link_to "Print Voids
List",{:action=>"print_voids"},:popup=>[''new_window'',''height=300,width=600'',''scrollbars=yes'']%>
Maybe?:
<%= link_to_function icon(''icon_printer'', :alt =>
''Print'') + ''Print
Cable'', :action = ''display_popup'', :popup =>
[''display_popup_to'',
''width=650,height=600,scrollbars=yes, menubar=1''],
"window.print();" %>
This is purely a guess though, I haven''t tried it out. But the
"window.print()" part does work on my app, I think you just have to
find
a way to combine the two. Good luck,
-S
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---