Forms

  • trucks79
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0

trucks79 created the topic: Forms

I am still trying to see if this works for me.
what i am trying to do is-
create a series of forms that we can use at work to carry out monthly checks, almost all of the forms will consist of

Date box
approx 8-10 tick boxes for pre set questions
option to upload a couple of photos for evidence
signature

sounds simple but i need to be able to able to make sure that each form submitted is sent via email as a pdf and includes everything on the form including any pictures and signature rather than file attachment links.

can someone please advise how i can do this?
#238912
  • Posts: 2986
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Forms

Hello,

Here crosstec.org/en/support/online-documenta...68-admin-emails.html it is explained how to set a PDF attachment to be sent along with an email after the form is submitted.

You can change the looks of the PDF by alternating the pdf template as explained here crosstec.org/en/support/online-documenta...-s-pdf-template.html .

Here is the code for the template that should show images and signature in the PDF as you have explained:
<?php
/**
 * BreezingForms - A Joomla Forms Application
 * @version 1.8
 * @package BreezingForms
 * @copyright (C) 2008-2012 by Markus Bopp
 * @license Released under the terms of the GNU General Public License
 **/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
// IMPORTANT!
// Supported Tags: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small
?>
<table border="1" width="100%">
	<tr>
		<td colspan="2" bgcolor="#cccccc" align="left" valign="middle">
			<h2><?php echo $this->submitted; ?></h2>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_ID') ?>:</strong>
		</td>
		<td>
			<?php echo $this->form; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_SUBMITTEDAT') ?>:</strong>
		</td>
		<td>
			<?php echo $this->submitted; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_IP') ?>:</strong>
		</td>
		<td>
			<?php echo $this->ip; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_BROWSER') ?>:</strong>
		</td>
		<td>
			<?php echo htmlentities($this->browser, ENT_QUOTES, 'UTF-8');  ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_OPSYS') ?>:</strong>
		</td>
		<td>
			<?php echo htmlentities($this->opsys, ENT_QUOTES, 'UTF-8');  ?>
		</td>
	</tr>
	<tr>
		<td colspan="2" bgcolor="#cccccc">
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_DATA') ?>:</strong>
		</td>
	</tr>
	<?php
	if (count($xmldata)){
		foreach ($xmldata as $data) {
			?>
			<tr>
				<td>
					<strong>   <?php echo wordwrap(htmlentities($data[_FF_DATA_TITLE], ENT_QUOTES, 'UTF-8'), 40, '<br />', true); ?>:</strong>
				</td>
				<td>

					<?php if( $data[_FF_DATA_TYPE] == "File Upload" ) {
						 $image = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
                echo '<img src="' . $image . '" width="150" height="150" border="0"/> ' ; 
					}

					else { echo $data[_FF_DATA_TYPE] == 'Signature' && file_exists(JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE]) ? '<img src="'.JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE].'" />' : nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8')); } 
					 ?> 
				</td>
			</tr>
			<?php
		}
	}
	?>
</table>

I'm also sending you an example of a PDF generated for a test form using this code.


Let me know whether this is what you wanted to achieve.

Regards,

Mihaela
#238925
Attachments:
The following user(s) said Thank You: trucks79
  • trucks79
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0

trucks79 replied the topic: Forms

thanks mate i am now getting an error?

TCPDF ERROR: [Image] Unable to get the size of the image: /var/www/vhosts/jpsdocportal.co.uk/httpdocs/media/breezingforms/signatures/
#238938
  • trucks79
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0

trucks79 replied the topic: Forms need help ;(

thanks, the screen shot you sent is perfect!
however i cant get it to work, i have removed and reinstalled breezing forms as i think i deleted some scripts in error

so so i replace all the code in the pdf_attachment file with the code that you put?

mihaela wrote: Hello,

Here crosstec.org/en/support/online-documenta...68-admin-emails.html it is explained how to set a PDF attachment to be sent along with an email after the form is submitted.

You can change the looks of the PDF by alternating the pdf template as explained here crosstec.org/en/support/online-documenta...-s-pdf-template.html .

Here is the code for the template that should show images and signature in the PDF as you have explained:

<?php
/**
 * BreezingForms - A Joomla Forms Application
 * @version 1.8
 * @package BreezingForms
 * @copyright (C) 2008-2012 by Markus Bopp
 * @license Released under the terms of the GNU General Public License
 **/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
// IMPORTANT!
// Supported Tags: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small
?>
<table border="1" width="100%">
	<tr>
		<td colspan="2" bgcolor="#cccccc" align="left" valign="middle">
			<h2><?php echo $this->submitted; ?></h2>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_ID') ?>:</strong>
		</td>
		<td>
			<?php echo $this->form; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_SUBMITTEDAT') ?>:</strong>
		</td>
		<td>
			<?php echo $this->submitted; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_IP') ?>:</strong>
		</td>
		<td>
			<?php echo $this->ip; ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_BROWSER') ?>:</strong>
		</td>
		<td>
			<?php echo htmlentities($this->browser, ENT_QUOTES, 'UTF-8');  ?>
		</td>
	</tr>
	<tr>
		<td>
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_OPSYS') ?>:</strong>
		</td>
		<td>
			<?php echo htmlentities($this->opsys, ENT_QUOTES, 'UTF-8');  ?>
		</td>
	</tr>
	<tr>
		<td colspan="2" bgcolor="#cccccc">
			<strong><?php echo BFText::_('COM_BREEZINGFORMS_DATA') ?>:</strong>
		</td>
	</tr>
	<?php
	if (count($xmldata)){
		foreach ($xmldata as $data) {
			?>
			<tr>
				<td>
					<strong>   <?php echo wordwrap(htmlentities($data[_FF_DATA_TITLE], ENT_QUOTES, 'UTF-8'), 40, '<br />', true); ?>:</strong>
				</td>
				<td>

					<?php if( $data[_FF_DATA_TYPE] == "File Upload" ) {
						 $image = nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8'));
                echo '<img src="' . $image . '" width="150" height="150" border="0"/> ' ; 
					}

					else { echo $data[_FF_DATA_TYPE] == 'Signature' && file_exists(JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE]) ? '<img src="'.JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE].'" />' : nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8')); } 
					 ?> 
				</td>
			</tr>
			<?php
		}
	}
	?>
</table>

I'm also sending you an example of a PDF generated for a test form using this code.


Let me know whether this is what you wanted to achieve.

Regards,

Mihaela

#238941
  • trucks79
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0

trucks79 replied the topic: Forms need help ;(

Thanks again, the issue I am getting is any pictures uploaded are too big for the box section and over shoots the box?

How can I set it so it resizes the picture to fit the box ? Like in your example
#239026
  • Posts: 2986
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Forms need help ;(

Hello,

This part should resize the pictures to fit:
echo '<img src="' . $image . '" width="150" height="150" border="0"/> ' ;

Is that not having effect?

Regards,

Mihaela
#239048
Time to create page: 0.280 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here