Formit Checkbox Info Not Sending

Formit Checkbox Info not sending

I have a working Formit form. I can successfully send & receive the form.
The only issue is the checkbox data is blank in the email received. All other fields I am receiving the form info

This is my code (only relevant parts included for brevity)

   &successMessage=`Your comment has been submitted successfully, please check your email.`
   &emailSubject=`[[+name]] Sent You a Message`

```Checkbox Code

    <label>Article Type: [[!+fi.error.artsize]]</label>
    <input type="hidden" name="artsize[]" value="" />
    <label><input type="checkbox" name="artsize[]" value="[[!+fi.artsize:FormItIsChecked=`Article`]]" > Article</label></li>
    <li><label><input type="checkbox" name="artsize[]" value="[[!+fi.artsize:FormItIsChecked=`Article Long`]]" > Article Long</label></li>

And the TPL

<br /><p>Hey There,</p>
<p>[[+name]] just submitted your Form</p>
<p>Email: [[+email]]</p>
<p>Website: [[+subject]]</p>
<p>Article: [[+artsize]]</p>
<p>Message: [[+text]]</p>

Can anyone suggest where I might be going wrong?

Possibly the placeholders in your two value fields for the checkboxes are not set at the time those lines are parsed. You could try then without the !, since it delays the processing of the tags.

Adding this to the code that processes the form can be helpful:

$modx->log(modX::LOG_LEVEL_ERROR, print_r($_POST), true);

The error log should show exactly what’s getting through.

Change the checkbox code from

<input type="checkbox" name="artsize[]" value="[[!+fi.artsize:FormItIsChecked=`Article`]]" >


<input type="checkbox" name="artsize[]" value="Article" [[!+fi.artsize:FormItIsChecked=`Article`]] >

[[!+fi.artsize:FormItIsChecked=`Article`]]` returns checked="checked" if the value was set in the request. You can’t use this for the value attribute.

Hi Bob,
Thanks for taking the time to respond, that looks like a useful piece of code for troubleshooting.
Very helpful :grinning:

Hi Harry,

Your suggestion worked like a charm :smiley:

Really appreciate you taking the time to respond and solve my issue.
I will mark your answer as the Solution

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.