Is it possible for the email with the results in it to only show fields that have been filled out, so on my forms we have fields that do not need to be filled out, is it possible to not show them in the results email?
Forums
Only email filled fields in email
Hi lachlanyoung1992,
Yes, but to do that you need to use a Custom Code action to create a dynamic template that only included the parts that you need. There are several examples here but the basic code is a bit like this:
Bob
Yes, but to do that you need to use a Custom Code action to create a dynamic template that only included the parts that you need. There are several examples here but the basic code is a bit like this:
<?php
$email_body = array();
$email_body[] = "<p>Hi {$form->data['name']}</p>";
$email_body[] = 'Some standard text here';
if ( $form->data['some_input'] ) {
$email_body[] = "<p>Label: {$form->data['some_input']}</p>";
}
// . . . and so on
$form->data['email_template'] = implode("\n", $email_body);
?>
Them put {email_template} in the email template.
Bob
This topic is locked and no more replies can be posted.