We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40735
    • 119 Posts
    Hey guys!
    I'm trying to create a submenu on my site that only displays the documents in the current section of the tree. I have six or so root-level resources that I want to be the menu top no matter how far down users drill. I'm open to other solutions but the idea that I had was to create a checkbox template variable called sectionStart, check it on the pages that I want to be the top level in the menu, and then use the findParent extra to search up the tree and get the ID of that document which can then be passed to Wayfinder. Trouble is, I don't know what to give findParent for the needle when I use a checkbox. Here's what I have:

    [[findParent? &id=`[[*id]]` &haystack=`tv.sectionStart` &needle=`true` &return=`id`]]


    This doesn't return anything. What value do checkbox template variables contain when checked? I've tried "true" and "checked" with no luck.
    Thanks!

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      When you created the checkbox, you had something like this in your Option Values field
      Option 1==opt1||Option 2==opt2

      So the value of the clicked checkbox would be the value on the right of the expression; if the second of the above boxes is checked its value will be opt2.
        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
        • 40735
        • 119 Posts
        Okay, there's a tab called Input Options that contains a text area labeled Input Option Values. I took at stab at it there and put in Option 1==true and made sure my needle in findParent was set to true as well but no dice.

        Edit:
        It turns out it actually did work I just didn't realize it because I was on the page that I had checked in the manager. So my only issue now is how do I get it to pass Wayfinder the current ID if findParent doesn't return anything? [ed. note: dwillis210 last edited this post 14 years, 1 month ago.]
        • discuss.answer
          • 4172
          • 5,888 Posts
          does this work?

          [[findParent:default=`[[*id]]`? &id=`[[*id]]` &haystack=`tv.sectionStart` &needle=`true` &return=`id`]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 40735
            • 119 Posts
            It does! Thank you!