1

Is there any way to add conditions to custom mails in Breezing Forms? Documentation doesn't show anything like that. So if values are empty, the HTML gets messed up with blanks.

I'd like to do e.g.:

{if someField:value}<h3>Some title</h3>{if}
1
  • How are you calling the fields? You can use PHP for this of course.
    – Eoin
    Commented Jun 24 at 17:11

1 Answer 1

1

You can use this setting:

https://crosstec.org/en/support/online-documentation/breezingforms/18-email-configuration/68-admin-emails.html

Report "non-empty values" which won't show the empty ones.

If you are using a custom template then you might prefer to use PHP.

Here is how you set up the PHP https://crosstec.org/en/support/online-documentation/breezingforms/10-advanced-settings/739-how-do-email-templates-work.html

<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
 
<?php if ($RECORD_ID != ''): ?>
<?php echo $PROCESS_RECORDSAVEDID?> <?php echo $RECORD_ID ?><?php echo $NL ?>
<?php endif; ?>
 
<?php echo $PROCESS_FORMID?>: <?php echo $FORM ?><?php echo $NL ?>
<?php echo $PROCESS_FORMTITLE ?>: <?php echo $TITLE ?><?php echo $NL ?>
<?php echo $PROCESS_FORMNAME ?>: <?php echo $NAME ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTEDAT ?>: <?php echo $SUBMITTED ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERIP ?>: <?php echo $IP ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERID ?>: <?php echo $SUBMITTERID ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERUSERNAME ?>: <?php echo $SUBMITTERUSERNAME ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERFULLNAME ?>: <?php echo $SUBMITTERFULLNAME ?><?php echo $NL ?>
<?php echo $PROCESS_PROVIDER ?>: <?php echo $PROVIDER ?><?php echo $NL ?>
<?php echo $PROCESS_BROWSER ?>: <?php echo $BROWSER ?><?php echo $NL ?>
<?php echo $PROCESS_OPSYS ?>: <?php echo $OPSYS ?><?php echo $NL ?>
 
<?php foreach ($MAILDATA as $DATA): ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php endforeach; ?> 

You could just do an if statement before the second last line.

<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
 
<?php if ($RECORD_ID != ''): ?>
<?php echo $PROCESS_RECORDSAVEDID?> <?php echo $RECORD_ID ?><?php echo $NL ?>
<?php endif; ?>
 
<?php echo $PROCESS_FORMID?>: <?php echo $FORM ?><?php echo $NL ?>
<?php echo $PROCESS_FORMTITLE ?>: <?php echo $TITLE ?><?php echo $NL ?>
<?php echo $PROCESS_FORMNAME ?>: <?php echo $NAME ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTEDAT ?>: <?php echo $SUBMITTED ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERIP ?>: <?php echo $IP ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERID ?>: <?php echo $SUBMITTERID ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERUSERNAME ?>: <?php echo $SUBMITTERUSERNAME ?><?php echo $NL ?>
<?php echo $PROCESS_SUBMITTERFULLNAME ?>: <?php echo $SUBMITTERFULLNAME ?><?php echo $NL ?>
<?php echo $PROCESS_PROVIDER ?>: <?php echo $PROVIDER ?><?php echo $NL ?>
<?php echo $PROCESS_BROWSER ?>: <?php echo $BROWSER ?><?php echo $NL ?>
<?php echo $PROCESS_OPSYS ?>: <?php echo $OPSYS ?><?php echo $NL ?>
 
<?php foreach ($MAILDATA as $DATA): ?>
<?php if($DATA[_FF_DATA_VALUE] !== "") { ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php } ?>
<?php endforeach; ?> 

You might want to do some error checking in case you need null instead of "" or empty or something instead.

1
  • 1
    Reporting non-empty values doesn't work as it leaves e.g. : between empty values, or any other HTML. Thanks for the PHP hint though, didn't know that possibility exists.
    – Destroy666
    Commented Jun 24 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.