empty field->dont show in email

How to hide empty or specific dropdown values in a ChronoForms email template.

Overview

The issue occurs when an email template displays form fields even when they are empty or contain a specific value that should be hidden.
Use conditional PHP code within the email template to check if a field is not empty and does not equal a specific value before displaying it. For a dependent text field, add a separate condition to check if it is not empty.

Answered
md mdma 15 Sep, 2015
Hello, how may this be realised in email-Template custom?

now:
[code<table>
<tr><td>field1</td><td>{field1}</td></tr>
<tr><td>field2</td><td>{field2}</td></tr>[/code]

to something like
<?php echo "<table>"
if (!empty({field1})) { echo <tr><td>field1</td><td>{field1}</td></tr>} 
if (!empty({field2})) {echo<tr><td>field2</td><td>{field2}</td></tr>

?>
md mdma 15 Sep, 2015
oh sorry for asking,
I found some similar threads now in the forum
md mdma 18 Sep, 2015
Hello, Its getting tougher now
i need a statement like if !empty and !some_value of dropdown show in email


<?php if(!empty($form->data["myfield"]) || !($form->data["myfield"] == some_value)): ?>
myfieldlabel: {myfield}<?php endif; ?>
Gr GreyHead 18 Sep, 2015
Hi mdma,

That should work OK. what exactly is the problem?

Bob

PS I prefer to use a Custom code action before the Email action to process the data and build parts of the template code but either method should work OK.
md mdma 18 Sep, 2015
Hello Bob!!
first part is working with !empty field
second part !value of the field doesnt work...
<?php if(!empty($form->data["myfield"]) || !($form->data["myfield"] == some_value)): ?>
myfieldlabel: {myfield}<?php endif; ?>
md mdma 18 Sep, 2015
maybe something ith isset?
md mdma 18 Sep, 2015
Answer
got it now:

if( !empty($form->data["myfield"]) &&  !($form->data["myfield"] ==some_value)): ?>
myfieldlabel: {myfield}<?php endif; ?>


i use this for a dropdown event:if some_value selected ->show other txt field.
so in the email if "some_value" was selected the data from other txt_field is important
and not the data of dropdown value...
md mdma 18 Sep, 2015
and :
<?php if(!empty($form->data["other_txt_field"])): ?>
other_txt_fieldlabel: {other_txt_field}<?php endif; ?>
This topic is locked and no more replies can be posted.