addScriptDeclaration($script);?>"> print button on thank you page not working - Forums

Forums

print button on thank you page not working

skhn123 03 Sep, 2014
Hi bob

i was using your code to print the thank you page but however its not working in choronoform v5 but it was working in v3. I dont know why but can you help me on this.
i follow your instruction on faqs and this is the code i am using i haven't change anything.

<?php
$doc =& JFactory::getDocument();
$script = "
function printPage()
{
var html, css, csss_file, printWin;
css = \"\";
css = \"<style type='text/css'>\"+css+\"</style>\";
css_url = '';
if ( css_url !== '' ) {
css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";
}
html = '<html><head>'+css+css_url+'</head>'+$(id).innerHTML+'</html>';

printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=0, scrollbars=0, status=0' );
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
var id;
window.addEvent('domready', function() {
id = 'print_div';
$('print_button').setStyle('visibility', 'visible');
$('print_button').addEvent('click', printPage);
});
";
$doc->addScriptDeclaration($script);
?>
GreyHead 04 Sep, 2014
Hi skhn123,

I think that this should still work with CFv5 provided that MooTools is being loaded - but it really needs to be re-written for jQuery.

Please post a link to the form so I can take a quick look and see if I can spot what the problem is.

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