Forums

Email not show empty fields with checkboxes

amheng5 20 Nov, 2015
Hi I was successful in creating email to show just fields with completed content; however I notice that checkbox fields are not showing the selected options. Here's 1st part of the code. The ''Preferred Contact Phone' line is the checkbox field.
    <p>
    <?php
    $var_array = array(
'First Name' => 'firstname',
'Last Name' => 'lastname',
'School Year' => 'schoolYear',
'Street Address' => 'streetAddress',
'Address' => 'cityStateZC',
'Email' => 'email',
'Home Phone' => 'homephone',
'Cell Phone' => 'cellphone',
'Preferred Contact Phone' => 'sharePhone',
'Rate Range' => 'rateRange',
'School' => 'schoolName',
'Grade Subject Level' => 'gradeSubjectLevel',

----------------------------------------------------------------------------------
When the email is sent the end result is:
Preferred Contact Phone: Array

Please advise what other code is required to have the correct content to appear. It should have been:
Preferred Contact Phone: Home, Cell

When I generate a separate email to submitter using the auto generated code (table), the check box field appears correctly with the selected options.

Your assistance is appreciated. Thanks
amheng5 23 Nov, 2015
Hi, I read thru your faq instructions and I placed into my email event, but I not sure if I can embed this array code into the existing code as it resulted in blank email. Please advise. Thanks
    <p>
    <?php
    $var_array = array(
'First Name' => 'firstname',
'Last Name' => 'lastname',
'School Year' => 'schoolYear',
'Street Address' => 'streetAddress',
'Address' => 'cityStateZC',
'Email' => 'email',
'Submit Date' => 'cf_created',
'Home Phone' => 'homephone',
'Cell Phone' => 'cellphone',
<?php
$phonetype_array = array(
  home => 'Home',
  cell => Cell'
);
$sharePhone = array(  
Home => 'Home',
  Cell => 'Cell');
foreach ( $form->data['phonetype'] as $v ) {
  $sharePhone[] = $phonetype_array[$v];
}
$form->data['phonetype'] = implode(', ', $sharePhone);
?>
'Rate Range' => 'rateRange',
'School' => 'schoolName',
GreyHead 23 Nov, 2015
Hi amheng5,

I don't understand what your code is trying to do :-(

The handle arrays action will convert an array value to a string for use in an email.

Bob
amheng5 23 Nov, 2015
I'm sure I'm not explaining clearly.

I have a message going to a contact person. Some of the fields are group check box that allows more than one selection. If user completes this check box field then I want it to make it appear in the list of other fields completed. So for example the following list is what I want to appear (partial listing)
_______________________________________
School Year: 2015-2016
Street Address: any street
Address: city state 00000
Email: email address
Home Phone: 000-000-0000
Cell Phone: 000-000-0000
Phone Type: Home, Cell

--------------------------------------------------
My code for this (again partial)
<p>
<?php
$var_array = array(
'First Name' => 'firstname',
'Last Name' => 'lastname',
'School Year' => 'schoolYear',
'Street Address' => 'streetAddress',
'Address' => 'cityStateZC',
'Email' => 'email',
'Submit Date' => 'cf_created',
'Home Phone' => 'homephone',
'Cell Phone' => 'cellphone',
'Phone Type' => 'sharePhone',
______________________________________________
I've created the necessary handle arrays. but the email result only shows
Phone(s) to Share with Clients: array

I tried to just insert the code you referenced the FAQ link provided me earlier, but no success. Ended up resulting in a blank messages.

Is this possible to include group check box fields within the body of the hidden field code for all my 20+ fields? Or what is the workaround?

Thanks
GreyHead 24 Nov, 2015
Hi amheng5,

I have no idea at all what your code is for or how it is supposed to work. What happens if you just put {phonetype} in the Email template - assuming that is the correct name of the input.

Bob
amheng5 24 Nov, 2015
Nevermind. I'll work this out. You had helped me a while back on this code and it worked great, but with use of group checkbox the intended input did not appear.
GreyHead 24 Nov, 2015
Hi amheng5,

Ah . . . is the code to build a template leaving out the empty boxes? (I see a lot of code and don't' always remember).

If so, put the Handle Arrays action before the Custom Code action and it should work like any other input.

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