Forums

Joomla Menu ChronoForm Pdf

BNDragon 30 Jan, 2014
Hello to everybody,
I have a new doubt and doubt I can do, but before I rule out this possibility I would like to be sure.
So is the following:
I want to create a menu that allows me to create a pdf, but this pdf have to contein the form of the page in question.
Is it possible?

Greatings
BN
GreyHead 30 Jan, 2014
Answer
Hi BN,

Yes that is possible.with CFv4.

You need to get the PDF action from Max - ask him using the Contact Us link above.

Then create a new form event like On PDF and add the PDF action to it plus the code to get the data from the form.

Lastly, when that is working link the Menu to the form using &event=PDF in the URL

Bob
BNDragon 31 Jan, 2014
Hi Bob,

Thanks, seizing the opportunity, and a button on the form to print, whatever their status (completed or not).
I saw a faq but did not really understand what it was supposed to do.
Can enlighten me a bit?

Greatings
BN
GreyHead 31 Jan, 2014
Hi BN,

The FAQ pretty much describes what you need to do to add a print button. Nothing much I can add here unless you have a specific question.

Bob
BNDragon 31 Jan, 2014
Hi Bob,

Ok then, i'll try again and come back with some specific question in case it don't work!😉

Greatings
BN
BNDragon 31 Jan, 2014
Hi Bob,

Sorry to bother you again, but I don't get it :/

So, this is what i done:

In Event OnLoad i only set the ShowHtml action.

In Event OnSubmit i set:

-Show thanks Message action with this code:
-
<div id='print_div'>
<p>É este </p>
<table cellpadding="5" cellspacing="5" border="0">
	<tr>
		<td>
			<strong></strong>
		</td>
		<td>
			{}
		</td>
	</tr>
	<tr>
		<td colspan='2'>
			<label id="qtdLoja">Quantidade</loja>
		</td>
	</tr>
	<tr>
		<td>
			<strong>2008 Vale de Pios</strong>
		</td>
		<td>
			{insP1}
		</td>
	</tr>
	<tr>
		<td>
			<strong>2007 Pios</strong>
		</td>
		<td>
			{insP2}
		</td>
	</tr>
	<tr>
		<td>
			<strong>2008 Excomungado</strong>
		</td>
		<td>
			{insP3}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Azeite Virgem Extra 1/2L</strong>
		</td>
		<td>
			{insP4}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Azeite Virgem Extra 5L</strong>
		</td>
		<td>
			{insP5}
		</td>
	</tr>
	<tr>
		<td>
			<strong></strong>
		</td>
		<td>
			{}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Nome</strong>
		</td>
		<td>
			{insNome}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Endereço Factura</strong>
		</td>
		<td>
			{insEnderecoFactura}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Telefone</strong>
		</td>
		<td>
			{insTelefone}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Endereço Entrega</strong>
		</td>
		<td>
			{insEnderecoEntrega}
		</td>
	</tr>
	<tr>
		<td>
			<strong>Email</strong>
		</td>
		<td>
			{insEmail}
		</td>
	</tr>
	<tr>
		<td>
			<strong></strong>
		</td>
		<td>
			{}
		</td>
	</tr>
</table>

</div>


<input type="button" value="Print" id='print_button' style='visibility: hidden;'>

   - Custom Code with this code:
        -<?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);
?>



But the button dont show up, and if i let it be visible it don't work :s

Can U say what i'm doing wrong?
I want to put this on load, but first i want to understand how it works.

Thank you for your attention and patience!

Greetings
BN
GreyHead 31 Jan, 2014
HI BN,

It sounds as though there is a JavaScript error on the page that needs to be fixed. Please post a link to the form so I can take a quick look.

Bob
BNDragon 31 Jan, 2014
Hi Bob,

That is a complicated issue, because it is not yet online. :s
But today, still no set time, due to my server administrator, I will put it online.
So the problem is not in what I wrote right?

Greatings
BN
GreyHead 31 Jan, 2014
Hi BN,

Not as far as I can tell from a quick look at the code, so nothing obvious,

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