Formbuilder: how to only show the filled fields

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
babel
Forum Members
Forum Members
Posts: 149
Joined: Fri Oct 19, 2012 8:58 pm

Formbuilder: how to only show the filled fields

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder: how to only show the filled fields

Post 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
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
babel
Forum Members
Forum Members
Posts: 149
Joined: Fri Oct 19, 2012 8:58 pm

Re: Formbuilder: how to only show the filled fields

Post by babel »

Thanks Jo Morg for you quick reply. I'll let you (and others) know if it worked.
babel
Forum Members
Forum Members
Posts: 149
Joined: Fri Oct 19, 2012 8:58 pm

Re: Formbuilder: how to only show the filled fields

Post 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?
babel
Forum Members
Forum Members
Posts: 149
Joined: Fri Oct 19, 2012 8:58 pm

Re: Formbuilder: how to only show the filled fields

Post by babel »

It's solved. Only the filled fields are showing in the recipients mail. Thanks for your help
Locked

Return to “Modules/Add-Ons”