My workaround for this problem:
[!emailFormUserInfo!]
[!eForm? &eformOnBeforeMailSent=`emailFormUserInfo` &formid=`ContactForm` ... !]
Before the eForm-call, the snippet
emailFormUserInfo is loaded. The eForm-call uses
&eformOnBeforeMailSent=`emailFormUserInfo`, that activates function
emailFormUserInfo from the snippet above before mail is sent.
<?php
function emailFormUserInfo (&$fields) {
// Checkboxes
$checkBoxes = array (
'myCheckbox01' => '[x] some request',
'myCheckbox02' => '[x] another strange demand',
);
foreach (array_keys($checkBoxes) as $checkBox) if (strlen($fields[$checkBox]) > 0) $fields[$checkBox] = $checkBoxes[$checkBox];
...
return true;
}
?>
Note, that strlen() of the checkbox's value has to be greater than 0. isset() doesn't work here, it is always true.
I've changed HTML for checkboxes from
<input type="checkbox" name="myCheckbox01" value="[x] some request" eform="some name 01::1" />
<input type="checkbox" name="myCheckbox02" value="[x] another strange demand" eform="some name 02::1" />
to
<input type="checkbox" name="myCheckbox01" value="1" eform="some name 01::1" />
<input type="checkbox" name="myCheckbox02" value="1" eform="some name 02::1" />
by replacing strings with integers.
Surely, this issue can be fixed much more elegant. At least, I was glad to have the forms working again and my customer didn't explode.
Every form with a mandatory checkbox and string value probably won't work anymore.
[ed. note: mr.odo last edited this post 11 years ago.]