Closed jpdevries closed 7 years ago
Hey @jpdevries This is not really a FormIt issue; it's default behaviour in HTML that when you post a form with unchecked checkboxes (or radiobuttons) that that field does not get posted. The proposed fix for this is to include an empty hidden field before the actual checkboxes to always send an empty value when no checkbox is checked. See https://docs.modx.com/extras/revo/formit/formit.tutorials-and-examples/formit.handling-selects,-checkboxes-and-radios for more info on this.
Ah ok thanks @joeke
Summary
Property tags for fields with no value (like unchecked checkboxes) are not processed when the email is sent
Step to reproduce
Add a checkbox to your form:
I can provide a teleport snapshot or MODX login to a blank MODX install with the issue.
In your
emailTpl
output the checkbox:[[+useMODX]]
Submit the form with the checkbox unchecked, and with it checked. Notice if the checkbox is checked it works correctly. You'll see "Yes I use MODX" in the email. If the checkbox is not checked you will see the escaped MODX tag
[[+useMODX]]
in the email.Observed behavior
If the checkbox is not checked you will see the escaped MODX tag
[[+useMODX]]
in the email.In
/core/components/formit/model/formit/fihooks.class.php
I can see that$fields
does not contain an element for an unchecked checkbox.Expected behavior
If the field has no value the MODX tag should still be parsed, and thus not output anything at all.
Environment
n/a