The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Display text for checkbox group not being passed to email - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Display text for checkbox group not being passed to email (/showthread.php?tid=1402)



Display text for checkbox group not being passed to email - wavesource - Jun 23rd, 2011

Not sure if this is my misconfig or a bug/feature of FormTools:

I've set up a checkbox group which collects values like
lt_ffel_fff|lt_fdir_ddd|lt_fout_fff|lt_plus and set the corresponding display text to something more legible for the clients eg. Loan Type External, Loan Type Internal etc.

and while viewing the submissions in FormTools is perfect, with the checkboxes displayed with display text, I see the email notifications coming through with just the raw data, eg.

Loan Type
lt_ffel_fff|lt_fdir_ddd|lt_fout_fff|lt_plus

I have changed the data array delimiter for the whole script to be pipe, as you can see - has this screwed with the display text being set in the email template? Or...?


RE: Display text for checkbox group not being passed to email - Ben - Jun 26th, 2011

Good question! Yeah, it looks like that's what's happening.

But you can fix this like so. Just do a little conversion in your email template:

Code:
{assign var=arr value="|"|explode:$ANSWER_field1}
{", "|implode:$arr}

(Assuming that $ANSWER_field1 refers to your checkbox field).

Hope this helps.

- Ben









RE: Display text for checkbox group not being passed to email - wavesource - Jun 26th, 2011

Hi Ben

I've placed your string into the template thus:

{if $ANSWER_loan_type}
<tr>
<td style="font-weight: bold">Loan Type</td>
<td>{assign var=arr value="|"|explode:$ANSWER_loan_type}
{", "|implode:$arr}{$ANSWER_loan_type}</td>
</tr>
{/if}

Not getting any changes - have I interpreted your directions correctly?

Cheers

David


RE: Display text for checkbox group not being passed to email - Ben - Jun 27th, 2011

Almost... but weird you're not seeing the comma delimited output. I just tested it locally and it works fine for me. Change it to this:

Code:
{if $ANSWER_loan_type}
<tr>
<td style="font-weight: bold">Loan Type</td>
<td>{assign var=arr value="|"|explode:$ANSWER_loan_type}
{", "|implode:$arr}</td>
</tr>
{/if}

That should only output the comma-delimited value, not the original value. I have to ask: are you sure the submission you're testing with has a value in that field?

- Ben


RE: Display text for checkbox group not being passed to email - wavesource - Jun 30th, 2011



Code:
{if $ANSWER_loan_type}
<tr>
<td style="font-weight: bold">Loan Type</td>
<td>{assign var=arr value="|"|explode:$ANSWER_loan_type}
{", "|implode:$arr}</td>
</tr>
{/if}

Yep, it definitely has a values in the field - and it's definitely not responding - just tightened and checked the template, this is in place:

Code:
{if $ANSWER_loan_type}
<tr>
<td style="font-weight: bold">Loan Type</td>
<td>{assign var=arr value="|"|explode:$ANSWER_loan_type}
{", "|implode:$arr}</td>
</tr>
{/if}

Outputs to email thus:

Code:
Loan Type          lt_ffel_fff, lt_fdir_ddd, lt_fout_fff, lt_plus

Field option group is set up OK - see screenshot - *shrug*



RE: Display text for checkbox group not being passed to email - Ben - Jul 1st, 2011

Good GRIEF, this is actually a bug with 2.0.6 - how remarkable. You're not doing anything wrong - the email template is just being passed the raw values; not the actual display values. Let me think about this.

- Ben


RE: Display text for checkbox group not being passed to email - Ben - Jul 1st, 2011

Well! That was surprising. So yeah, there's a bug in the code that's just outputting the values - not the display values. Astonishing no-one's mentioned it...!

I'm not going to release a patch release for this, though. It'll be fixed in 2.1, but I won't release 2.0.7 just to fix this one issue.

However, to fix it in your case, just replace the _ft_get_placeholder_hash() function on line 1345 of /code/emails.php with this code:

Code:
/**
* Generates the email content for a particular template - either HTML or text.
*
* @param integer $form_id The unique form ID
* @param integer $submission_id The unique submission ID
* @param array $client_info a hash of information about the user to whom this email is being sent
* @return array a hash of placeholders and their replacement values (e.g. $arr["FORMURL"] => 17)
*/
function _ft_get_placeholder_hash($form_id, $submission_id, $client_info = "")
{
  global $g_root_url, $g_multi_val_delimiter;

  $placeholders = array();

  $settings        = ft_get_settings();
  $form_info       = ft_get_form($form_id);
  $submission_info = ft_get_submission($form_id, $submission_id);
  $admin_info      = ft_get_admin_info();


  // now loop through the info stored for this particular submission and for this particular field,
  // add the custom submission responses to the placeholder hash
  foreach ($submission_info as $field)
  {
    $field_id   = $field["field_id"];
    $field_name = $field["field_name"];
    $field_type = $field["field_type"];

    if ($field_type != "system")
      $placeholders["QUESTION_$field_name"] = $field["field_title"];

    if ($field_type == "file")
    {
      $extended_settings = ft_get_extended_field_settings($field_id, "core");
      $placeholders["FILENAME_$field_name"] = $field["content"];
      $placeholders["FILEURL_$field_name"]  = "{$extended_settings["file_upload_url"]}/{$field["content"]}";
    }
    else
    {
      if ($field_type != "system")
      {
        if (in_array($field_type, array("radio-buttons", "checkboxes", "select", "multi-select")))
        {
          $content = "";
          if (!empty($field["content"]))
          {
            $options = ft_get_field_options($field_id);
            $vals = explode($g_multi_val_delimiter, $field["content"]);
            $display_vals = array();

            foreach ($options as $option_info)
            {
              if (in_array($option_info["option_value"], $vals))
              {
                $display_vals[] = $option_info["option_name"];
              }
            }
            $content = implode(", ", $display_vals);
          }

          $placeholders["ANSWER_$field_name"] = $content;
        }
        else
        {
          $placeholders["ANSWER_$field_name"] = $field["content"];
        }
      }
    }

    if ($field['col_name'] == "submission_date")
      $placeholders["SUBMISSIONDATE"] = ft_get_date($settings['default_timezone_offset'], $field["content"], $settings["default_date_format"]);

    if ($field['col_name'] == "last_modified_date")
      $placeholders["LASTMODIFIEDDATE"] = ft_get_date($settings['default_timezone_offset'], $field["content"], $settings['default_date_format']);

    if ($field['col_name'] == "ip_address")
      $placeholders["IPADDRESS"] = $field["content"];
  }

  $placeholders["ADMINEMAIL"]   = $admin_info["email"];
  $placeholders["FORMNAME"]     = $form_info["form_name"];
  $placeholders["FORMURL"]      = $form_info["form_url"];
  $placeholders["SUBMISSIONID"] = $submission_id;
  $placeholders["LOGINURL"]     = $g_root_url . "/index.php";

  if (!empty($client_info))
  {
    $placeholders["EMAIL"]       = $client_info["email"];
    $placeholders["FIRSTNAME"]   = $client_info["first_name"];
    $placeholders["LASTNAME"]    = $client_info["last_name"];
    $placeholders["COMPANYNAME"] = $client_info["company_name"];
  }

  extract(ft_process_hooks("end", compact("placeholders"), array("placeholders")), EXTR_OVERWRITE);

  return $placeholders;
}

That should fix it up!

Let me know if you continue to have problems.

- Ben


RE: Display text for checkbox group not being passed to email - wavesource - Jul 1st, 2011

Hi Ben

Your code hack did the trick - multi-variable fields are now printing out one variable per line in emails with display text OK - it's a beautiful thing:

Quote:Loan Type
STUDENT LOAN MARKETING ASSOC./TEXAS
Loan Type
OREGON STUDENT ASSISTANCE COMMISSION

Thanks a bunch!

David


RE: Display text for checkbox group not being passed to email - Ben - Jul 8th, 2011

No worries, glad it's working now. Smile

- Ben