We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29266
    • 12 Posts
    Hi. I got this from documentation.

    <label>
            Colors:[[+fi.error.colors]]
            <input type="hidden" name="colors[]" value="" />
        </label>
        <ul>
          <li>
            <label><input type="checkbox" name="colors[]" value="red" [[!+fi.colors:FormItIsChecked=`red`]] /> Red</label>
          </li>
          <li>
            <label><input type="checkbox" name="colors[]" value="blue" [[!+fi.colors:FormItIsChecked=`blue`]] /> Blue</label>
          </li>
          <li>
            <label><input type="checkbox" name="colors[]" value="green" [[!+fi.colors:FormItIsChecked=`green`]] /> Green</label>
          </li>
        </ul>
    


    What shoud i put in Email chunk to make it work? In my email i recieve only [[+colors]]
      • 1778
      • 659 Posts
      Hello

      In your email you can do something like that :
      
      Red: [[+red:if=`[[+red]]`:eq=`1`:then=`Yes`:else=`No`]]
      Blue: [[+blue:if=`[[+blue]]`:eq=`1`:then=`Yes`:else=`No`]]
      
      OR
      [[+red:if=`[[+red]]`:eq=`1`:then=`Red`:else=``]]
      [[+blue:if=`[[+blue]]`:eq=`1`:then=`Blue`:else=``]]
      
      
      


      If you want to have a list of the checked boxes you’ll have to write a snippet that loops through the checkboxes, and output the list you want.
      Hope this helps
      Cheers

      EDIT : As you use an array of values (’colors[]’), I saw recently that you can also do something like
      [[+colors.0]]
      [[+colors.1]]
      


      I hope one of these solutions work for you
        • 29266
        • 12 Posts
        Thanks for help. Wrote a snippet.
        Call: [[%snippetName%?name=`%fieldName%`]]
        keep storing post data until redirected.

        <?php
          $target = array();
          $target = $_POST[$name];
          
          if(isset($target[1])) {
            echo "<ul>\r\n";
            foreach($target as $v) {
              if(!empty($v))
                echo "<li>".$v."</li>\r\n";
            }
            echo "</ul>\r\n";
          }
        ?>
        
          • 11927
          • 105 Posts
          I found that this works:
          Colors: [[+colors.0:isnot=``:then=`[[+colors.0]] <br />`:else=``]][[+colors.1:isnot=``:then=`[[+colors.1]] <br />`:else=``]][[+colors.2:isnot=``:then=`[[+colors.2]] <br />`:else=``]]


          But maybe the snippet above would be cleaner, but where do you execute the snippet?

          I tried in the &emailTpl, but it didn’t work. It just output the snippet call.
            You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

            Carpet Cleaning
            • 46407
            • 5 Posts
            hi,

            Has anyone ever used the formit tags: [[!+fi.fieldname:FormItIsSelected=`optionvalue`] in a static html file and received a strange message in their editor "Unexpected Character in Unquoted Attribute" ? See attached:
              • 4172
              • 5,888 Posts
              I think its defined here, where modx-tags are processed/highlighted:
              https://github.com/danyaPostfactum/modx-ace/blob/master/core/components/ace/elements/plugins/ace.plugin.php#L44

              you should do a feature-request at github, if you want the option to have it also for files.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 4172
                • 5,888 Posts
                $modxTags = $extension == 'tpl';
                


                or try to make the extension for that files: .tpl
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!