We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40131
    • 40 Posts
    I am stuck on the following:

    There a number of checkboxes:

    
    <input type="checkbox" name="g1[]" value="1" [[!+fi.g1:FormItIsChecked=`1`]]>
    <input type="checkbox" name="g1[]" value="2" [[!+fi.g1:FormItIsChecked=`2`]]>
    ...
    <input type="checkbox" name="g1[]" value="N" [[!+fi.g1:FormItIsChecked=`N`]]>
    


    In the email chunk it try this:

    1. If this is set [[+g1]] I get space delimited list of values (for the checked checkboxes only), e.g. 1 2 ...
    2. If I set:

    [[!If? &subject=`[[+g1]]` &operator=`eq` &operand=`1` &then=`Text 1<br>`]]  
    
    or 
    
    [[!If? &subject=`[[+g1]]` &operator=`inarray` &operand=`1` &then=`Text 1<br>`]]  
    
    - DOES NOT work / cached / uncached [[!+g1]] or [[!+fi.g1]]
    
    [[+g1:is=`1`:then=`Text 1`]] - doesn't work
    


    The above output modifications return the code itself... i.e. like it is escaped and not parsed and returned as text!?

    I need numbers for the values for other purposes, that is why I do not set the value as text on all checkboxes.


    Any clues?
    • Unfortunately the email tpl is not parsed, other than the placeholder replacement; it is not part of any MODx resource to be parsed by MODx.

      You can use a custom hook to set the field's value; make sure it's registered in the &hooks property before the email hook. http://rtfm.modx.com/display/ADDON/FormIt.Hooks#FormIt.Hooks-CustomHooks

        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