Hello,
I am trying to print out the form fields and values after a form has been posted. I can get the fields to display on the default thank you page, but there isn't a nice print button available. If the user uses File->Print, then they get the entire website.
Any suggestions to cleanly print this?
Thanks
I am trying to print out the form fields and values after a form has been posted. I can get the fields to display on the default thank you page, but there isn't a nice print button available. If the user uses File->Print, then they get the entire website.
Any suggestions to cleanly print this?
Thanks
Hi Pat, I don't think there is some way to do this, but I will look for one
Cheers
Max
Cheers
Max
I'm open to other suggestions. It doesn't need to be the standard Joomla print button. Just something so it prints cleanly.
Hi koolie,
A couple of half-baked thoughts,
[list]You could try using a pop-up window of some kind with the form contents formatted in it. Or maybe redirect to a page with the index2.php that omits the template framework Or maybe create a new 'form' containing the content and use the plugin/mambot to put that into a content page Or maybe find the print button code and include that in your form page. [/list]I haven't tried any of these and they may not work . . . or they may.
Bob
A couple of half-baked thoughts,
[list]
Bob
Hi koolie,
to print the results you will need the print version of the page and the best is to have a popup, lets walk to this step by step, first create a new form or even add this code in the onsubmit after email :
let me know what can you see after the form is submitted now and if its a print link then click it and let me know the results!
Cheers,
Max
to print the results you will need the print version of the page and the best is to have a popup, lets walk to this step by step, first create a new form or even add this code in the onsubmit after email :
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=form1' + CouponID,'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>
let me know what can you see after the form is submitted now and if its a print link then click it and let me know the results!
Cheers,
Max
When using your code verbatim, the window failed to open. I got a JS error that said 'CouponId is not defined'. I'm not sure which variable you were trying to pass, so I simply tried removing it. My updated code was:
This allowed the window to open, but it basically opened the unfilled-out form.
I think this idea will work, I'm just not sure what you were trying to do with the CouponID.
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=MemForm','AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>This allowed the window to open, but it basically opened the unfilled-out form.
I think this idea will work, I'm just not sure what you were trying to do with the CouponID.
Hi Pat,
yes, I just copied this from an old project code with some couponid thing😉
ok, can you point this to another form which has the profile plugin enabled and configured to load the last added record values ? you will need to have the data stored of this form.
Cheers,
Max
yes, I just copied this from an old project code with some couponid thing😉
ok, can you point this to another form which has the profile plugin enabled and configured to load the last added record values ? you will need to have the data stored of this form.
Cheers,
Max
I will try this right now, but can you explain a little further on the "point this to another form which has the profile plugin enabled"? I havent ever used this plugin, but I will start looking at it and see if I can walk myself through it. Also, by pointing, do you mean redirect the thank you page?
Ok...I think I understand what you are getting at, but am having trouble getting the value I need to pass. I want to go to the print form with a value in the address bar like 'last=34'. However, I cant seem to get the id right now. Here is my current code for 'On Submit code - after sending email:' - but the page dies with an error of: 'Parse error: syntax error, unexpected T_STRING in httpdocs/components/com_chronocontact/chronocontact.php(537) : eval()'d code on line 12'
Is there something wrong with my code, or is the program having trouble parsing?
<?php
echo "<h4>E-mail message</h4>
<div style='border:1px solid black; padding:6px;margin:6px;'>
<p>From: $fromname [$from]<br />
To: ".implode($recipient,', ')."<br />
Subject: $subject</p>
$html_message<br /></div>";
$q = mysql_query(SELECT max( `cf_id` ) FROM `jos_chronoforms_1`) or die(mysql_error());
$rs = mysql_fetch_array($q);
$last_id = $rs[0];
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>', 'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>
Is there something wrong with my code, or is the program having trouble parsing?
Hi koolie,
I think you need quotes round the SQL string
better practice it to use the Joomal code here (assumes Joomla 1.5)
Bob
I think you need quotes round the SQL string
$q = mysql_query("SELECT max( `cf_id` ) FROM `jos_chronoforms_1`") or die(mysql_error());better practice it to use the Joomal code here (assumes Joomla 1.5)
$db = & JFactory::getDBO();
$sql = "SELECT MAX( `cf_id` ) FROM #__chronoforms_1";
$db->setQuery($sql);
$last_id = $db->loadResult();NB : not tested may need debugging.Bob
Yes it was the quotes...boy do I feel sheepish :-)
I realize the bad practice, but I am not very familiar with the code structure for Joomla. Do you by chance know what code I would use for 1.0?
I realize the bad practice, but I am not very familiar with the code structure for Joomla. Do you by chance know what code I would use for 1.0?
Success!!!
I had to do a little work around - and i need about 10 forms like this - but I should be good to go now.
Here's what I did.
1. Made a blank template with nothing more than a javascript print button that gets hidden by the CSS when printed
2. Made a menu that doesnt appear anywhere on the site to place the "print forms"
3. Created a component menu item that goes to the print form - this was simply so I could specify what pages to use the blank template
4. Changed the 'On Submit code - after sending email:' popup window to go to:
5. And voilà printable form results!
Thank you so much for your help! This project has been a pain for the last couple weeks and I have been putting off making the forms - because I knew it would be rough. I certainly have some work to do, but at least it is attainable!
btw, I would still like the Joomla 1.0 best practice code for dB queries if you know it. Thanks again...Wahoo!!
I had to do a little work around - and i need about 10 forms like this - but I should be good to go now.
Here's what I did.
1. Made a blank template with nothing more than a javascript print button that gets hidden by the CSS when printed
2. Made a menu that doesnt appear anywhere on the site to place the "print forms"
3. Created a component menu item that goes to the print form - this was simply so I could specify what pages to use the blank template
4. Changed the 'On Submit code - after sending email:' popup window to go to:
index.php?option=com_chronocontact&Itemid=77&last=<?php echo $last_id; ?> - aka: the menu item link5. And voilà printable form results!
Thank you so much for your help! This project has been a pain for the last couple weeks and I have been putting off making the forms - because I knew it would be rough. I certainly have some work to do, but at least it is attainable!
btw, I would still like the Joomla 1.0 best practice code for dB queries if you know it. Thanks again...Wahoo!!
Hi koolie,
From memory I think that Joomla 1.0 woudl be
Bob
From memory I think that Joomla 1.0 woudl be
global $database;
$sql = "SELECT MAX( `cf_id` ) FROM #__chronoforms_1";
$database->setQuery($sql);
$last_id = $database->loadResult();just the call to the database object is different.Bob
Hi Pat,
was this a Joomla 1.0 or 1.5 site ?
Max
was this a Joomla 1.0 or 1.5 site ?
Max
Ok that's fine, I was going to present another J1.5 solution.
cheers
Max
cheers
Max
If you have another idea, I'm sure it wouldn't hurt to mention it. For my company personally, we are not using 1.5 yet - but should be soon. So, I might run into a need to do this in 1.5.
Someone else might too :-)
Thanks again for all your help.
Someone else might too :-)
Thanks again for all your help.
Hi Pat,
I would say that you can load another form with the profile plugin enabled which will get the last record too as you did, however I would show the J1.5 version of code to get the last record, that's all😉
Cheers
Max
I would say that you can load another form with the profile plugin enabled which will get the last record too as you did, however I would show the J1.5 version of code to get the last record, that's all😉
Cheers
Max
I am also using J1.5 and trying to print to a custom form with post values.
I see that users are printing values from posts submitted into a database. Is there a way to have a submitted form not posting into a database still open a custom form with the post values to print. If so what do I need to do?
Thanks
Doyle
I see that users are printing values from posts submitted into a database. Is there a way to have a submitted form not posting into a database still open a custom form with the post values to print. If so what do I need to do?
Thanks
Doyle
Hi Doyle,
I'm afraid this is not possible unless you want to show print screen after submit and lose your site template, the print screen will open in a new window and show the print results and so it must load the data from somewhere.
OR if you can get some JS code to open a window popup with contents from a div in the parent window then we can get this working, but I don't have this JS myself!
Cheers
Max
I'm afraid this is not possible unless you want to show print screen after submit and lose your site template, the print screen will open in a new window and show the print results and so it must load the data from somewhere.
OR if you can get some JS code to open a window popup with contents from a div in the parent window then we can get this working, but I don't have this JS myself!
Cheers
Max
Ok, then how do I get it to work in J1.5???
Thanks
Thanks
Hi, get the code here : http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=11311&st=0&sk=t&sd=a#p15192
and follow my instructions in the thread just above it to get a print link shown after the form submit, does this work fine ?
and follow my instructions in the thread just above it to get a print link shown after the form submit, does this work fine ?
This is what I get when I click on print.
ERROR:
There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management
This is the code I am using under On Submit code - after sending email:
The information for the name is also not passed. It shows blank. I am only entering 1 field.
ERROR:
There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management
This is the code I am using under On Submit code - after sending email:
<?php
echo "<h4>Name:</h4>
<div style='border:1px solid black; padding:6px;margin:6px;'>
<p>$text_0<br />
<div>";
$q = mysql_query("SELECT max( `cf_id` ) FROM `jos_chronoforms_pt_setup_forms`") or die(mysql_error());
$rs = mysql_fetch_array($q);
$last_id = $rs[0];
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>', 'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>The information for the name is also not passed. It shows blank. I am only entering 1 field.
First, did you make a form called "print_reg". Second, make sure you setup the profile plugin. Also, make sure that within the "print_reg" form you have 'Profile Page' plugin checked.
One other note related to last_id. For some reason, the last id really isnt the last id. I had to add a +1 to the variable. So in On Submit after Email I have
<?php
global $database;
$sql = "SELECT MAX( `cf_id` ) FROM #__chronoforms_1";
$database->setQuery($sql);
$last_id = $database->loadResult();
$last_id = $last_id + 1;
?>
I am missing someing.....am I using two forms or one form - the one being the form that the info is submitted?
Two.
The first form collects your data. Then, on your default "thank you" page (DO NOT REDIRECT only use the on submit after email area) you add code for the popup window.
That will go to another form...a print form. My print forms look like this
This page will have the profile plugin enabled and get the information from the last form created.
Have you used the profile plugin before? My values for the plugin for the print form are as follows:
Table Name: jos_chronoforms_1 (this will change depending on what form you want to retrieve data from)
REQUEST Parameter name: last
Target field name: cf_id
The first form collects your data. Then, on your default "thank you" page (DO NOT REDIRECT only use the on submit after email area) you add code for the popup window.
That will go to another form...a print form. My print forms look like this
<tr>
<td><div align="right">Name</div></td>
<td colspan="3"><div align="left">{name}</div></td>
</tr>
<tr>
<td><div align="right">Home Address </div></td>
<td colspan="3"><div align="left">{addy1}</div></td>
</tr>
<tr>
<td><div align="right">Apt/Suite</div></td>
<td colspan="3"><div align="left">{addy2}</div></td>
</tr>
<tr>
<td><div align="right">City</div></td>
<td colspan="3"><div align="left">{city}</div></td>
</tr>
This page will have the profile plugin enabled and get the information from the last form created.
Have you used the profile plugin before? My values for the plugin for the print form are as follows:
Table Name: jos_chronoforms_1 (this will change depending on what form you want to retrieve data from)
REQUEST Parameter name: last
Target field name: cf_id
Ok this is what I have.
Created form called form_1
1. input text field Name: {text_0}
2. On Submit code - after sending email:
3. Link to database: jos_chronoforms_form_1
4. data is showing in database.
Second, Created form print_reg
1.created blank form
2.On Submit code - after sending email:
3. Plugin table: Profile Page checked
4. Profile Page:
Table name: jos_chronoforms_form_1
REQUEST Parameter name: last
Target field name: cf_id
This is what I get:
1.Goto form and enter Name: and click submit
2. Goes to page with the name output and shows link to print.
3. When click on print it goes back to website with menu and header and a blank page.
What am I missing????
Created form called form_1
1. input text field Name: {text_0}
2. On Submit code - after sending email:
{text_0}<br>
<?php
$q = mysql_query("SELECT max( `cf_id` ) FROM `jos_chronoforms_form_1`") or die(mysql_error());
$rs = mysql_fetch_array($q);
$last_id = $rs[0] + 1;
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>', 'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>3. Link to database: jos_chronoforms_form_1
4. data is showing in database.
Second, Created form print_reg
1.created blank form
2.On Submit code - after sending email:
{text_0}3. Plugin table: Profile Page checked
4. Profile Page:
Table name: jos_chronoforms_form_1
REQUEST Parameter name: last
Target field name: cf_id
This is what I get:
1.Goto form and enter Name: and click submit
2. Goes to page with the name output and shows link to print.
3. When click on print it goes back to website with menu and header and a blank page.
What am I missing????
Hi,
Ok, starting from your last post here, this is what your code should look like :
at the 2nd form, add this code : {text_0} to the form HTML!
Cheers
Max
Ok, starting from your last post here, this is what your code should look like :
{text_0}<br>
<?php
global $row_jos_chronoforms_form_1;
$last_id = $row_jos_chronoforms_form_1->cf_id;
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>', 'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>
at the 2nd form, add this code : {text_0} to the form HTML!
Cheers
Max
This did not work. When I click on print a page opens with the website again with the menu and logo and it only shows {text_0}.
This is a clean install with the default theme with no extra stuff added.
I don't understand why this is so hard to get working. I understand the coding that I am using and what I am trying to get from it, but it will just not work.
What can I do??????
This is a clean install with the default theme with no extra stuff added.
I don't understand why this is so hard to get working. I understand the coding that I am using and what I am trying to get from it, but it will just not work.
What can I do??????
Just to verify, you removed the {text_0} code from the On Submit code - after sending email: and moved it to the HTML area of the print form. Your input field name is text_0 on the original form correct?
That is correct.
The other issue is that when I click on print it opens a new windows with the website again and not a black page with(without) the data.
The other issue is that when I click on print it opens a new windows with the website again and not a black page with(without) the data.
Does anyone have this working for Joomla 1.5.X???????
Hi,
Ok, starting from your last post here, this is what your code should look like :
{text_0}<br>
<?php
global $row_jos_chronoforms_form_1;
$last_id = $row_jos_chronoforms_form_1->cf_id;
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>', 'AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>
at the 2nd form, add this code : {text_0} to the form HTML!
Cheers
Max
The code did not work due to the $last_id did not pass the var.
This is what I did to get that working...
{text_0}
<?php
$q = mysql_query("SELECT max( `cf_id` ) FROM `jos_chronoforms_form_1`") or die(mysql_error());
$rs = mysql_fetch_array($q);
$last_id = $rs[0] +1;
?>
<script type="text/javascript">
function OpenAddWin()
{
var AddWin;
AddWin = window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>','AddWindow','menubar=no,resizable=no,scrollbars=yes,status=no,top=200,left=200,width=710,height=750');
if (!AddWin.opener){
AddWin.focus();}
else{
AddWin.focus();}
}
</script>
<a href="javascript:OpenAddWin()">Print</a>NOW, the problem is that when I click on the print link I get the information but it opens into a new window of the website and not into a black page.
How do I fix this??????
Hi, change this :
make it:
Cheers,
Max
window.open('index.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>',make it:
window.open('index2.php?option=com_chronocontact&chronoformname=print_reg&last=<?php echo $last_id; ?>',Cheers,
Max
That worked....
Is it possible to in the first place have the option to have the On Submit code - after sending email: goto index2.html?
You would then not need to do all the other options when you don't want the information going to a database.
Is it possible to in the first place have the option to have the On Submit code - after sending email: goto index2.html?
You would then not need to do all the other options when you don't want the information going to a database.
yes but when the user get a non template page it may be confusing for them ?
add the url above to the action url and replace the form name with the main form you have and add the {field_name} to the onsubmit after email!
Cheers
Max
add the url above to the action url and replace the form name with the main form you have and add the {field_name} to the onsubmit after email!
Cheers
Max
This topic is locked and no more replies can be posted.
