Forums

Handling multiple checkbox in the email template

winchesterlyon 10 Mar, 2015
Hi,

How do I handle the output for multiple checkboxes?

I would like them to output in a list like. Either using <li> tags or <br /> tags. Anyone is fine with me.

Thanks in advance.

Winchester
GreyHead 10 Mar, 2015
1 Likes
Hi Winchester,

You can use a Handle Arrays action to convert the array to a string - that will work with separators like ', ' or '<br />'

If you want to convert the array to a List then you'd need to use a Custom code action:
<?php
$list = array();
foreach ($form->data['checkboxes_99'] as $c ) {
  $list[] = "<li>{$c}</li>";
}
$list = implode("\n", $list);
$form->data['list'] = "<ul>{$list}</ul>";
?>
Then use {list} in the Email template.

Bob
winchesterlyon 10 Mar, 2015
Thanks GreyHead... I decided to use ChronoForm instead. Was having other issues with ChronoContact, but since there was no documents for it, I just figured it's best to just switch..
winchesterlyon 10 Mar, 2015
I should be able to use this with ChronoForm as well, right?
This topic is locked and no more replies can be posted.