Forums

checked options of checkbox group on separate line in e-mail

SAGO 15 Aug, 2017
Hi,

Is it possible to show each checked options from a Checkbox Group on a separate line in an e-mail. Now all checked options are show on one line and separated with a comma.

Is it also possible to hide Checkbox groupes where nothing was selected?

Thanks

Cheers
healyhatman 16 Aug, 2017
1 Likes
EDIT: Try in the email bit doing
{data.join[<br/>]:checkboxGroup}
or



You could do it in a PHP action at the very least?

like.... have a PHP action named 'optionsToString'

return str_replace("," , "<br/>", $this->data("checkboxGroup", ""));

Then in the email you put {optionsToString} where you want it?
SAGO 16 Aug, 2017
Hi,

Thank you for your reply.

The first method works. I first tried to add to code in the DESIGN-tab under Template and checked off "auto generate on form save" but it didn't work. I had to go to the Email-block in the SETUP-tab and activated BODY and put there your code and it worked perfectly! I'm still getting used to CF v6, It's new to me.

This is the code I ended up using to show a list of values of the checked items:
<ul style="margin-top:0px;"><li>{data.join[</li><li>]:checkboxes13}</li></ul>


Thanks Healyhatman for the quick fix!

The only thing left, is to hide the checkbox groups where nothing was selected. I mean the checkbox-groups label as well as the empty value
I don't think you can use php in the BODY inside the EMAIL-block in the SETYP-tab, right?
I tried with:
<?php if(!empty($form->data["checkboxes12"])): ?>

But that doesn't seem to be allowed.

If anyone has an idea, that would be great!

Thanks!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}