Buy Now
Sign in

Handling multiple checkbox in the email template

winchesterlyon , March 10 2015
W
winchesterlyon
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
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
    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much
    W
    winchesterlyon
    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..
    W
    winchesterlyon
    I should be able to use this with ChronoForm as well, right?
    GreyHead
    Hi Winchester,

    Yes,

    Bob
    ChronoForms technical support
    If you'd like to buy me a coffee or two, thank you very much