We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36930
    • 22 Posts
    I am wondering if anyone has any insight into how to create a single select dropdown TV that is populated with options that are pulled from data entered into a MIGX tv in a separate resource.

    I have tried @chunk binding, but it didn't process the snippet.

    @silentworks suggested MIGXdb, but the documentation is either way above my head or a little sparse.

    Maybe I am going about it wrong? What I ultimately want to achieve is to have a way for one admin to be able to select from a list of pre-populated content that has been generated by another admin.

    I could probably do this by using a resource list TV, but am trying to avoid a long list of resources in the tree being used just as stater content. The MIGX input just seems a little more elegant for my intentions.

    Thanks in advance.

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

      • 38290
      • 712 Posts
      Hi Justin,

      I think I can help you at least get started for now. I think you could accomplish this using the @EVAL Binding. http://rtfm.modx.com/display/revolution20/Bindings.

      By doing something like
      @EVAL return $modx->runSnippet('getMIGXTVValues');


      Now of course you'll need a magic getMIGXTVValues Snippet that finds the resource, gets the MIGX TV value, probably parses it as JSON, and returns the options formatted correctly but before all that, want to make sure you get introduce to the @EVAL binding.

      I'd create this snippet and have it return a static example for now:
      <?php
      return 'optionA==optionA||optionB==optionB||optionC==optionC';
      


      And once that is confirmed working I can help you make that snippet dynamic.
        jpdevries
      • discuss.answer
        • 4172
        • 5,888 Posts
        something like that should do the trick:

        @EVAL return $modx->runSnippet('getImageList',array('docid'=>'1','tpl'=>'@CODE:[[+image]]','outputSeparator'=>'||','tvname'=>'multiupload1'));
        
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 36930
          • 22 Posts
          Hi, thanks so much for the reply.

          It looks like we are in business, that snippet is working.

          What I currently have is a MIGX tv that has only two fields per row. In a perfect world, the dropdown would only show the title, but when selected it would output the richtext portion.

          MIGX tv

          -Form Tabs
          [
             {"caption":"Jobs", "fields": [
                {"field":"job-title","caption":"Job Title"},
                {"field":"job-descrip","caption":"Job Description","inputTVtype":"richtext"}
                ]
             }
          ]


          -Grid Columns
          [
             {"header": "Job Title", "width": "30", "sortable": "true", "dataIndex": "job-title"},
             {"header": "Job Description", "width": "70", "sortable":
             "false","dataIndex":"job-descrip"}
          ]
          • discuss.answer
            • 4172
            • 5,888 Posts
            try:

            [[getImageList? &where=`{"job-title":"[[*yourlistboxtv]]"}` &tvname=`yourmigxtv` &tpl=`@CODE:[[+job-descrip]]` &docid=`1`]]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 36930
              • 22 Posts
              Quote from: Bruno17 at Nov 15, 2012, 08:35 PM
              something like that should do the trick:

              @EVAL return $modx->runSnippet('getImageList',array('docid'=>'1','tpl'=>'@CODE:[[+image]]','outputSeparator'=>'||','tvname'=>'multiupload1'));
              

              This is quite close to what I am looking for. My MIGX tv has two fields (title and description). The dropdown displays the "title" from my MIGX tv, but then it also outputs just the title. Is it possible to have the dropdown show the title, but then output the description?
              • discuss.answer
                • 36930
                • 22 Posts

                Wow, that did it. Thanks so much for your help.

                So, to create the dropdown from the MIGX tv I use this:

                @EVAL return $modx->runSnippet('getImageList',array('docid'=>'1','tpl'=>'@CODE:[[+job-title]]','outputSeparator'=>'||','tvname'=>'yourmigxtv'));
                


                Then to output the second field from option selected from that dropdown i use this:

                [[getImageList? &where=`{"job-title":"[[*yourlistboxtv]]"}` &tvname=`yourmigxtv` &tpl=`@CODE:[[+job-descrip]]` &docid=`1`]]
                

                  • 42072
                  • 2 Posts
                  guys

                  i am off the topic here.

                  I am based in South Africa, we are looking for free-lance developers to co-work on industry specific platform.

                  if interested, let me know. email also good - [email protected]

                  best!