We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28107
    • 230 Posts
    Im absolutely confused.

    I'm getting a Formit value [[+fi.category]] an reuse it with FormitRetriever in a Template

    The template looks like
    --[[+fi.category]]--
    [[[[+fi.category:eq=`Day`:then=`$chunk.day`:else=`$chunk.night`]]]]


    fi.category is filled with 'Day' but I always get the night.chunk delivered.

    (modx 2.3.1)
      CONIN Werbeagentur . Köln
      http://www.conin.de
      • 4172
      • 5,888 Posts
      did you try to call it uncached?

      [[[[!+fi.category:eq=`Day`:then=`!$chunk.day`:else=`!$chunk.night`]]]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 28107
        • 230 Posts
        yepp
        I don't have the faintest idea, whats wrong.

          CONIN Werbeagentur . Köln
          http://www.conin.de
          • 4172
          • 5,888 Posts
          you have formitRetriever running above this tag?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 28107
            • 230 Posts
            Quote from: Bruno17 at Nov 11, 2014, 04:42 AM
            you have formitRetriever running above this tag?

            yes

            as a check
            --[[+fi.category]]--
            gives me the correct value (or the value that is selected).
              CONIN Werbeagentur . Köln
              http://www.conin.de
              • 4172
              • 5,888 Posts
              this placeholder would also be filled, if formitRetriever was behind it, in the template with a later parsing-loop,
              but the output-filter will be resolved with else, if the placeholder wasn't set, in the first parsing-loop.

              what about trying getReqParam like:

              [[[[!getReqParam:eq=`Day`:then=`!$chunk.day`:else=`!$chunk.night`? &name=`category`]]]]


              or with the fastField - Post - tag?
              [ed. note: Bruno17 last edited this post 11 years, 11 months ago.]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 28107
                • 230 Posts
                Quote from: Bruno17 at Nov 11, 2014, 04:42 AM
                you have formitRetriever running above this tag?

                will try that later

                I'm now on the run from Karneval ...
                  CONIN Werbeagentur . Köln
                  http://www.conin.de
                  • 3749
                  • 24,544 Posts
                  How about a snippet:

                  [[!DayNight? &cat=`[[+fi.category]]`]]



                  <?php
                  /* DayNight snippet */
                  $cat = $modx->getOption('cat', $scriptProperties, '';
                  if (empty($cat)) {
                     return 'Category not set';
                  }
                  $chunk = ($cat == 'Day')? 'chunk.day' : 'chunk.night;
                  return $modx->getChunk($chunk);


                  BTW, if the categories are named Day and Night, you could have the chunks named Day and Night and have a one-line snippet:

                  <?php
                  /* DayNight snippet */
                  return $modx->getChunk($modx->getOption('cat', $scriptProperties));
                  
                    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
                    • 28107
                    • 230 Posts
                    yepp, will check that too.

                    many thx for pointing in to the right direction.
                      CONIN Werbeagentur . Köln
                      http://www.conin.de