Forums

Displaying checkbox values as a list in e-mail

Jnijman 15 Feb, 2011
Hello ChronoEngine community,

Currently my Chronoform generates a comma seperated output of the selected checkboxes in my e-mails.
This is not how I want it to be displayed, instead I want it to be displayed as a list with each item on a single line.

Example of current situation: Checkbox1, Checkbox2, Checkbox3

Example of how I want it:
Checkbox1
Checkbox2
Checkbox3

I have been searching the forums for some time now and can't find anything on how to get it to display the way I want.
There must be an easy way to accomplish this but I fail to find it😶 .

Please help me out.
Many thanks in advance.

Kind Regards,
Jnijman
GreyHead 15 Feb, 2011
Hi Jnijman,

You can turn off "Let ChronoForms handle array results" in the form General tab and do it by hand in the OnSubmit Before Code box instead:
<?php
$check0 = JRequest::getVar('check0', array(), 'post', 'array');
$check0_list = implode('<br />', $check0);
JRequest::setVar('check0_list', $check0_list);
?>
Then use {check0_list} in the Email Template.

Bob
Jnijman 16 Feb, 2011
Hi Bob,

Thank you for your reply, I have tried adding it the way you have described and somehow my mail displays {check0_list} instead of the value's.
I'm trying to see what I might have done wrong, If I find it I'll post it here, but until then I gladly accept help.

Kind Regards,
Jnijman
Jnijman 16 Feb, 2011
I have found the cause of my e-mail not displaying the values, the code you posted was missing a comma in the getVar Method.

So I have changed it to:
<?php
$check0 = JRequest::getVar('check0', array(), 'post', 'array');
$check0_list = implode('<br />', $check0);
JRequest::setVar('check0_list', $check0_list);
?>


And now it's working fine.
Bob thank you very much for your help😀

Kind Regards,
Jnijman
GreyHead 16 Feb, 2011
Hi Jnijman,

Apologies for my typo.

I've fixed my original post.

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