We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Oh, I'm sorry! I thought you had a TV named "searchable!"

      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
      • 32316
      • 387 Posts
      I tried this with your code and got the same results, i.e. always yes.

      So to trouble shoot (and see the value of 'searchable' I tried this in my resource:
      <p>
      this is searchable: [[*searchable]].
      </p>
      
      Search: [[YesNo? &value=`[[*searchable]]`]]


      And this worked, I got yes or no depending on the search setting, with searchable = "" or "1"
      I have no idea why this made it work at the moment

      played with it a little more - very strange, but I don't have time right now to follow up. [ed. note: whistlemaker last edited this post 14 years, 7 months ago.]
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Ok, then. It is probably a caching issue. Is the resource cached? Then the snippet must be called uncached. Otherwise the page will be served with the value from the first time it's generated. I've noticed that in Revo resources aren't set to clear the cache on saving, so just changing the "searchable" setting won't clear the cache.
          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
          • 32316
          • 387 Posts
          Duh!!!!!!!
          Must be too late.
          It works just fine if one calls it uncached:
          [[!YesNo &value=`[[*searchable]]`]]


          edit: off to bed before my head hits the keyboard!
            • 35082
            • 57 Posts
            Thanks for taking a look whistlemaker.

            Susan, the resource is un-cached. I've also tried manually clearing the cache on each save, still same results. Called the snippet un-cached, no change.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Hm. Almost beginning to look like a bug. Even with the snippet uncached it has the same value unless the cache is cleared or the resource is not cacheable.

              I think under the circumstances it would be best to access the value programmatically rather than using the snippet properties.

              $modx->resource->get('cacheable');

                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
                • 35082
                • 57 Posts
                whistlemaker, I just tried the code
                <p>
                this is searchable: [[*searchable]].
                </p>
                 
                Search: [[YesNo? &value=`[[*searchable]]`]]

                and that works just fine. Very weird indeed. The 'this is searchable' line displays a null value when the box is unchecked, or the number 1 when it's checked.

                The 'search' line displays Yes or No depending on box status, as it should. [ed. note: ironchip last edited this post 14 years, 7 months ago.]
                  • 35082
                  • 57 Posts
                  I just tried calling the snippet uncached, as I could have sworn I did before, and it works now:

                  [[!YesNo &value=`[[*searchable]]`]]
                    • 35082
                    • 57 Posts
                    A big thanks guys for taking the time out of your busy schedules to assist me, and helping me to become un-stuck.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      In the database it's 1 or 0, so something in the way the resource tag is being generated is acting strangely. That's why I'd prefer to access the value directly via the API in a snippet.
                        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