We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9572
    • 56 Posts
    I have a FormIt form which is working great however I am running into an issue regarding checkboxes.

    When a user selects a checkbox in the form and then submits, the proper value appears in the confirmation email that I have set up with FormIt AutoResponder. However, if a user does not select a checkbox, the placeholder is then sent in the email. Below is an excerpt from the email that the form sends:

    Two-Way Radios?: Yes (Extra radios? 0)
    
    Unlimited Translation: [[+unlimited-translation]]


    If a user selects the "Unlimited Translation" checkbox, the value returned is "Yes" but I'd like to set a default value in the event that the user does not select that checkbox.

    Any suggestions?
    • I believe that with a post-hook, you can modify any of the form field values that are inserted into the mailing tpl.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 9572
        • 56 Posts
        I'm not all that familiar with post-hooks unfortunately. I thought this would be a fairly common issue actually. It doesn't seem like FormIt has a posthook property either, I only see a prehook.

        EDIT: Found this thread, would this work even though I already have an output filter on the checkboxes? (Is it possible to chain output filters?)
        http://forums.modx.com/thread/47671/emails-showing-radio-option-code-if-none-selected#dis-post-431019

        EDIT 2: So I added the notempty output filter into the email template and it works.

        [[+unlimited-translation:notempty=`[[+unlimited-translation]]`]]


        Guess I answered my own question. [ed. note: fegul last edited this post 11 years, 2 months ago.]
          • 3749
          • 24,544 Posts
          In FormIt, postHooks are just called "hooks"

          Yes, most output modifiers can be chained.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting