We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    hi,

    I'm having issues with the If statement & the presence of an equals sign in the &then attribute, this does not work:

    [[!If? &subject=`[[+loginfp.errors]]` &operator=`!empty` &then=`<div class="inline-error">[[+loginfp.errors]]</div>` ]]


    this does:
    [[!If? &subject=`[[+loginfp.errors]]` &operator=`!empty` &then=`<div class"inline-error">[[+loginfp.errors]]</div>` ]]


    The content page this is on is just blank if I leave the equals sign in there. I have tried to put the error message in it's own chunk, but I get the same error.

    Does anyone know how [is it possible?] to escape characters in the If statements??

    using Revo 2.1.3

    -thanks
    -sean
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 3749
      • 24,544 Posts
      You should be able to put the HTML with the equals sign in a chunk and use this:

      [[!If? &subject=`[[+loginfp.errors]]` &operator=`!empty` &then=`[[$ErrorChunk ]]`
      


      There may be a better way.


      [ed. note: BobRay last edited this post 15 years, 1 month ago.]
        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
        • 26503
        • 620 Posts
        I did try that - no dice....

        your syntax is a little out of order... &then=`[[$ErrorChunk` ]] should be &then=`[[$ErrorChunk]]`

        ;)


        Trying to find the syntax to use if as a modifier... maybe something like:

        [[+loginfp.errors:If?:&subject=`[[+loginfp.errors]]`:&operator=`!empty`:&then=`<div class="inline-error">[[+loginfp.errors]]</div>` ]]
        



        dunno, havn't found the correct syntax to test it yet..

        -sean
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 3749
          • 24,544 Posts
          Sorry, fixed above. I would be inclined to just do this:

          <div class="inline-error">[[+loginfp.errors]]</div>


          But I think you could also check for the error in a posthook and set another placeholder with the code above if there's an error.
            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
            • 26503
            • 620 Posts
            The inline-error class has a bunch of padding and background color to make it look like a dialog box [sort of] so it can only be present on an error or else it throws the rest of the layout off...

            -sean
              *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

              Sean Kimball CLP, CLS.
              Technical Director / Sr. Developer | BigBlock Studios
              ._______________________________________________.
              Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
              27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
              phone/fax: 905-426-5525
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              What about this?

              [[!+loginfp.errors:notempty=`<div class="inline-error">[[!+loginfp.errors]]</div>`]]


              (Note that I'm calling the placeholders uncached - am assuming it is being set based on a request and you'll need it to be processed every request)
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 26503
                • 620 Posts
                Hmmmm exactly the same problem... the equals sign is causing problems.
                  *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                  Sean Kimball CLP, CLS.
                  Technical Director / Sr. Developer | BigBlock Studios
                  ._______________________________________________.
                  Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                  27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                  phone/fax: 905-426-5525
                  • 3749
                  • 24,544 Posts
                  This is a tough one. Try this (chunk uncached):

                  [[!If? &subject=`[[+loginfp.errors]]` &operator=`!empty` &then=`[[!$ErrorChunk ]]`


                  And these:

                  [[!+loginfp.errors:notempty=`[[$ErrorChunk ]]`]]
                  [[!+loginfp.errors:notempty=`[[!$ErrorChunk ]]`]]
                    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
                    • 26503
                    • 620 Posts
                    argh!

                    Nothing, I can get it load the error chunk, display the error, with either method [chunk or inline if] as soon as i place that equals sign, things blow up.

                    There has to be a bug somewhere.

                    -sean
                      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                      Sean Kimball CLP, CLS.
                      Technical Director / Sr. Developer | BigBlock Studios
                      ._______________________________________________.
                      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                      phone/fax: 905-426-5525
                      • 3749
                      • 24,544 Posts
                      Does the chunk display correctly with just a regular chunk tag?
                        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