We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    MODx 2.3.5 | FormIt 2.2.7

    I have a single check box. When checked, the email received contains the value of the checked item. But if not checked, the email contains the actual placeholder call, which is a bit confusing.

    Question: is that the normal behavior for check boxes, or have I written my code incorrectly?

           <label>OPTIONAL: Do you want to be added to the mailing list?</label>
          <input id="checkbox1" type="checkbox" name="addMe[]" value="Yes. Add me to the list." [[!+fi. addMe:FormItIsChecked=`Yes. Add me to the list.`]]><label for="checkbox1">Yes!</label>
    


    Initially, I had included [[!fi.error.addMe]] within the main lable, but this is not a required check box.

    Is name="addMe[]" causing the email message to show the placeholder? Should name simply be "addMe" with no brackets, since I only have one item?

    This question has been answered by rjohnson375. See the first response.

      • 19872
      • 1,078 Posts
      This is what I have in my email chunk
      p>Add to List?: [[+addMe]]</p>


      If checked, the email message contains
      Add to List?: Yes!

      If not checked, then the email message contains
      Add to List?: [[+addMe]]

      Having the placeholder there is confusing. If the checkbox is not checked, shouldn't the email message just contain nothing?
      Add to List?:
      • discuss.answer
        • 48586
        • 78 Posts
        I had a similar issue, this is what I did (using your code as an example):

        <label>OPTIONAL: Do you want to be added to the mailing list?</label>
        <input type="hidden" name="addMe[]" value="" />
        <input id="checkbox1" type="checkbox" name="addMe[]" value="Yes. Add me to the list." [[!+fi.addMe:FormItIsChecked=`Yes. Add me to the list.`]]><label for="checkbox1">Yes!</label>
        


        Edit: I also removed the space in "fi.addMe" from your code
          • 19872
          • 1,078 Posts
          Thank you very much for the feedback. Your suggestion works! [ed. note: mmcgee last edited this post 11 years, 2 months ago.]