We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36786 ☆ A M B ☆
    • 209 Posts
    I am trying to create a selectbox tv that is populated by the entries in a MIGX tv. This way a user can create "categories" in a parent resource and then in the child resources they can choose which category a child resource belongs to.

    This question has been answered by Bruno17. See the first response.

      Ben Morrison
      Hacking templates to pieces since 2003
      • 8274 ☆ A M B ☆
      • 222 Posts
      first, selectbox is a listbox? There isn't a "selectbox" input type I am aware of.

      If I am reading this correctly, then you would need to make the listbox tv values into an @EVAL binding, and point it to a custom snippet:
      @EVAL return $modx->runSnippet('myMIGXValues')


      The snippet would need to go get the MIGX tv value for the resource's parent, and parse the JSON value to return it in the proper format : Title == value || Title2 == value2

      More on @EVAL bindings here: http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/bindings/eval-binding

      As for the snippet itself, getting the TV value for a resource's parent can be a bit more involved. BobRay has a good write up on how to do it here: http://bobsguides.com/revolution-objects.html He addresses getting raw and processed TV values from different resources about halfway down the page.

      • discuss.answer
        • 4172
        • 5,888 Posts
        @EVAL return $modx->runSnippet('getImageList',array('tpl'=>'@CODE:[[+category]]','outputSeparator'=>'||','tvname'=>'yourMIGXtv','docid'=>'theParentsDocid'));
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 36786 ☆ A M B ☆
          • 209 Posts
          Works perfectly, thank you both!
            Ben Morrison
            Hacking templates to pieces since 2003