Page 1 of 1

Formbuilder: how to only show the filled fields

Posted: Wed Nov 13, 2019 12:07 pm
by babel
I have a long form where the recipient doesn't have to answer all the questions. After a submit the recipient gets a copy of the form in his mailbox. Now I want only that he receives the filled fields, because that's what he did. And it's user friendly.
Is there a way to achieve this?
I'm using CMS 2.2.12 and Formbuilder 0.8.1.6.

Re: Formbuilder: how to only show the filled fields

Posted: Wed Nov 13, 2019 12:18 pm
by Jo Morg
The emails sent by Formbuilder are parsed by Smarty so you can use its logic to show or hide whatever you chose. It only depends on what a field holds when not filed. If it's just empty then you can use something like

Code: Select all

{if !empty($fieldalias)}you submited {$fieldalias}{/if}
if it holds a default value or [unspecified] you just check for equality

Code: Select all

{if $fieldalias != '[unspecified]'}you submitted {$fieldalias} as your answer{/if}
etc...

Keep in mind that $fieldalias is just an example you'll need to use your field names or alias as you use them in your template

Re: Formbuilder: how to only show the filled fields

Posted: Wed Nov 13, 2019 12:38 pm
by babel
Thanks Jo Morg for you quick reply. I'll let you (and others) know if it worked.

Re: Formbuilder: how to only show the filled fields

Posted: Wed Nov 13, 2019 5:31 pm
by babel
Hallo Jo Morg,

I can't figure out your answer. My code is

Code: Select all

<tr><td>{if $fld_91 != "" && $fld_91 != "[niet opgegeven]" }Overige opmerkingen:</td><td>  {$fld_91}{/if}</td></tr>
. Where does your code fit in, if I want that in the mail the recipient doesn't see anything?

Re: Formbuilder: how to only show the filled fields

Posted: Wed Nov 13, 2019 5:36 pm
by babel
It's solved. Only the filled fields are showing in the recipients mail. Thanks for your help