Forums

CC5 - Print button problem

parsifaltheking 01 Sep, 2014
Hi, i've to add print button to CC5 report and i've read this post http://www.chronoengine.com/forums/posts/f12/t12650/add-a-print-button-to-a-chronoconnectivity-form.html but i've a problem.
The CC5 report has two research field in witch user insert start and end date and the system show only the interventions between the two date.
If used Brendan code changing the two parameter 1. option=com_chronoconnectivity5 2. ccname=<your connection> [instead of connectionname] [in agreement with this post: http://www.chronoengine.com/forums/posts/f12/t97237/add-print-button--cc5.html?hilit=PRINT+BUTTON+CHRONOCONNECTIVITY ] when i click print the report are reset, the two date empty and not show nothing.

If used rmesman code it print correcty the data in new windows but i've a problem: in new windows there are no buttons for print, there isnt a menu bar and I can not do anything.

What i can do to enable menu bar o launch print command from the new window?
Max_admin 07 Sep, 2014
I think that, the "window.open" line can changed to add your query parameters:
window.open('Link here'....

Use PHP code to capture the current url and echo it between the 2 quotes.

Another solution, please try to write the names of your date fields inside the "session stored fields" in CCv5, this may load the list with the date fields set!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
admin_wiky 18 Sep, 2014
1 Likes
hi, Try this code in header section

<?php
  $user = JFactory::getUser();
  $doc =& JFactory::getDocument();
  $script = "
  function printPage()
  {
      var html, printWin;
      css = '<style type=\"text/css\"></style>';
      html = '<html><head>'+css+'</head>'+print_div.innerHTML+'</html>';

      printWin = window.open('', '', 'left=100, top=100, width=1000, height=400, toolbar=0, scrollbars=0, status=0' );
      printWin.document.write(html);
      printWin.document.close();
      printWin.focus();
      printWin.print();
      printWin.close();
  }
  var id;
  jQuery(document).ready(function($){                        //window.addEvent doesn't work for me
      id = 'print_div';
      $('print_button').setStyle('visibility', 'visible');
      $('print_button').addEvent('click', printPage());     //impossible to get this working without () after printPage()
  });
  ";
  $doc->addScriptDeclaration($script);
?>

then button 4 print

<div style="float:right;margin-bottom:-40px;"><input type="image" src="PATH_TO_IMAGE" id="print_button" title="Print" onclick="printPage()"/></div>

then

<div id="print_div">
....code for print

in footer section

</div>
GreyHead 26 Sep, 2014
1 Likes
Hi,

I've just updated the ChronoForms FAQ here - which this CC code is based on - to include code for CFv5 using jQuery.

Bob
This topic is locked and no more replies can be posted.