Hi,
I use a checkbox group, which is populated by using Dynamic Data loaded from a DB table.
For example:
{ID:180, Title: Bristol}
{ID: 182, Title London}.
My Checkboxes then Display as :
[] - Bristol (The checkbox value is the ID(180));
[] - London (The checkbox value is the ID(182));
When the form is completed, the values are stored in a DB cell correctly (180, 182).
However, in the email, I want to send the text value of "Bristol" or "London" rather than the ID?
Is this possible? How can I access the Checkbox 'Text Key' rather than the 'Value'?
The email should read: "Hi, A new user has registered, and has selected Bristol, London.".
But, it currently reads : "Hi, A new user has registered, and has selected 180, 182."
All help greatly appreciated!
Thanks
I use a checkbox group, which is populated by using Dynamic Data loaded from a DB table.
For example:
{ID:180, Title: Bristol}
{ID: 182, Title London}.
My Checkboxes then Display as :
[] - Bristol (The checkbox value is the ID(180));
[] - London (The checkbox value is the ID(182));
When the form is completed, the values are stored in a DB cell correctly (180, 182).
However, in the email, I want to send the text value of "Bristol" or "London" rather than the ID?
Is this possible? How can I access the Checkbox 'Text Key' rather than the 'Value'?
The email should read: "Hi, A new user has registered, and has selected Bristol, London.".
But, it currently reads : "Hi, A new user has registered, and has selected 180, 182."
All help greatly appreciated!
Thanks
Hi GreyHEad,a nd thanks for the quick reply!
Just a little more help if possible?
1) Does this code go in a "Custom Code" before or after the "HandleArrays" event?
2) I am loading "checkboxgroup[]" from the DB dynamically, so I cannot 'hard type' the values the array will hold like you have with the code below.
I have adapted your code to the below, but this results in nothing being shown in the email?
Email:
Just a little more help if possible?
1) Does this code go in a "Custom Code" before or after the "HandleArrays" event?
2) I am loading "checkboxgroup[]" from the DB dynamically, so I cannot 'hard type' the values the array will hold like you have with the code below.
<?php
$color_array = array(
1 => 'green',
2 => 'blue',
3 => 'red',
4 => 'white'
);
$color_names = array();
foreach ( $form->data['colors'] as $v ) {
$color_names[] = $color_array[$v];
}
$form->data['color_names'] = implode(', ', $color_names);
?>
I have adapted your code to the below, but this results in nothing being shown in the email?
<?php
$location_array = $form->data['checkboxgroup[]'];
$location_names = array();
foreach ( $form->data['checkboxgroup[]'] as $v ) {
$location_names[] = $location_array[$v];
}
$form->data['location_names'] = implode(', ', $location_names);
?>
Email:
A new user has been created
1) {name}
2 ) {location_names}
This topic is locked and no more replies can be posted.