Forums

Field Names Showing on E-Mail

ddouglas 08 Jul, 2011
Hello,

I'm using Chrono Forms v4 RC1.9 on Joomla 1.6.4. When the email is sent and received, checkbox fields that the state of checked is showing the checked state just fine. If a field is unchecked, in the email it shows the {field}. See example of email below. Is there a way to show it blank or not at all if the state is unchecked?

Thanks,

Example: Wash Monthly state is checked, all others are unchecked.
Detailing & Washing Service
Wash Monthly Yes
Wash Bi-Weekly {wash_biweek}
Wash Weekly {wash_weekly}
Waxing/Detailing {wax_detail}
Topsides {topside}
GreyHead 09 Jul, 2011
Hi ddouglas,

Unfortunately an un-checked checkbox returns nothing at all when the form is submitted so ChronoForms doesn't know there is a 'null' result. You can drag in a Custom Code action and add this to it to set '' results for these checkboxes.
<?php
$checkbox_array = array(
  wash_biweek,
  wash_weekly,
  wax_detail,
  topside
);
foreach ( $checkbox_array as $v ) {
  if ( !$form->data[$v] ) {
    $form->data[$v] = '';
  }
}
?>


Bob
ddouglas 12 Jul, 2011
OK. But, if the values change (and they will), will wash_biweek, change to the value I have as 'Yes' or is this code as I understand it just for the entry that I had in my first post? These values will be different for each submission.

Thanks again,
GreyHead 12 Jul, 2011
Hi ddouglas,

I'm not sure I understand the question. The code just sets an empty '' as the value when the box is unchecked. It doesn't matter what values you have in the form.

Bob
ddouglas 12 Jul, 2011
Sorry for the incoherent reply but you answered the question. Thanks again Bob for the assist.
This topic is locked and no more replies can be posted.