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}
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}
You can use this setting:
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.
:
between empty values, or any other HTML. Thanks for the PHP hint though, didn't know that possibility exists.
Commented
Jun 24 at 17:46