Issue with Checkbox-Groups and Select-Lists

  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 68
  • Thank you received: 2

rd created the topic: Issue with Checkbox-Groups and Select-Lists

Hello,

we have an Issue with Checkbox-Groups and Select-Lists with multiple-Selection Option switched ON.

Values of Select-Lists and Checkbox-Groups are not transmitted in customized Pdfs. Only the last value is printed (Please see screenshot and pdf-file).

Here's the code of the Pdf-Template:
<?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
?>
<?php if ($RECORD_ID != ''): ?>
<?=$PROCESS_RECORDSAVEDID?> <?=$RECORD_ID ?><?=$NL ?><br />
<?php endif; ?>
	<?php
	$selectlist = '';


	if (count($xmldata)){
	   foreach ($xmldata as $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'));
	      switch($data[_FF_DATA_NAME]){
							case 'selectlist':
							          $selectlist = $value;
							          break;
				}
		}
	}
	?>

<?php echo $selectlist; ?>


File Attachment:

File Name: ffexport-p....pdf.zip
File Size:33 KB


Thank you
Regards
Rolf
#235336
Attachments:
  • MarioPuco
  • MarioPuco's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 5741
  • Karma: 118
  • Thank you received: 530

MarioPuco replied the topic: Issue with Checkbox-Groups and Select-Lists

Hi,

You need to define your checkbox groups as arrays in order to print all the values in your PDF attachment.
So you would need to define your selectlist group variable like this :
$selectlist;= array();

and also add this to the part below :

case 'collected':
          $selectlist;[] = $value;
          break; 

And finally to output this array you need to use implode function which will take all the array values and print them out as a string.
Previously you used :
<?php echo $selectlist; ?>

Replace it with :
<?php echo  implode(',',$selectlist;); ?>

And that's it ! Let us know if this worked for you.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#235355
  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 68
  • Thank you received: 2

rd replied the topic: Issue with Checkbox-Groups and Select-Lists

Hello Mario,

thank you for your response.
no, it's not working.

After submit I receive the following error message "Page could not be found" with the following error code:
0 syntax error, unexpected '=', expecting end of file
And no pdf is being sent.

Here is my code after changing it:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<?php if ($RECORD_ID != ''): ?>
<?=$PROCESS_RECORDSAVEDID?> <?=$RECORD_ID ?><?=$NL ?><br />
<?php endif; ?>
	<?php
	$selectlist;= array();


	if (count($xmldata)){
	   foreach ($xmldata as $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'));
	      switch($data[_FF_DATA_NAME]){
					case 'collected':
				          $selectlist;[] = $value;
				          break;
				}
		}
	}
	?>

<?php echo  implode(',',$selectlist;); ?>
I send you the form and the pdf-template. Both are in the attachment.

File Attachment:

File Name: temp.xml.zip
File Size:5 KB

File Attachment:

File Name: temp_pdf_a....php.zip
File Size:1 KB

Regards
Rolf
#235359
Attachments:
  • MarioPuco
  • MarioPuco's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 5741
  • Karma: 118
  • Thank you received: 530

MarioPuco replied the topic: Issue with Checkbox-Groups and Select-Lists

Hi,

I had a type in the code I sent :

I sent :
case 'collected':
          $selectlist;[] = $value;
          break;

While it shoud be :
case 'collected':
          $selectlist[] = $value;
          break;

Let me know if this worked.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#235362
  • rd
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 68
  • Thank you received: 2

rd replied the topic: Issue with Checkbox-Groups and Select-Lists

Hi,
no, the same as before.

Here's my code:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<?php if ($RECORD_ID != ''): ?>
<?=$PROCESS_RECORDSAVEDID?> <?=$RECORD_ID ?><?=$NL ?><br />
<?php endif; ?>
	<?php
	$selectlist;= array();

	if (count($xmldata)){
	   foreach ($xmldata as $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'));
	      switch($data[_FF_DATA_NAME]){
					case 'collected':
				          $selectlist[] = $value;
				          break;
				}
		}
	}
	?>

<?php echo  implode(',',$selectlist;); ?>

Regards,
Rolf
#235364
  • MarioPuco
  • MarioPuco's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 5741
  • Karma: 118
  • Thank you received: 530

MarioPuco replied the topic: Issue with Checkbox-Groups and Select-Lists

Please try this :
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<?php if ($RECORD_ID != ''): ?>
<?=$PROCESS_RECORDSAVEDID?> <?=$RECORD_ID ?><?=$NL ?><br />
<?php endif; ?>
	<?php
	$selectlist;= array();

	if (count($xmldata)){
	   foreach ($xmldata as $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'));
	      switch($data[_FF_DATA_NAME]){
					case 'collected':
				          $selectlist[] = $value;
				          break;
				}
		}
	}
	?>

<?php echo  implode(',',$selectlist;); ?>

Again I saw my typo and I corrected it.
Let me know if this works.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#235366
Moderators: ForumSupporttomeperica
Time to create page: 0.169 seconds

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!

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