We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Hi guys,

    I am trying to populate a drop down list of Input Options in a TV in the following format:

    pagetitle==page_id eg. (Welcome to MODx==1)

    I am using

    @SELECT CONCAT(pagetitle, ’==’, id, ’||’) FROM [+PREFIX+]site_content WHERE parent = 123

    But I get

    pagetitle==page_id||
    pagetitle==page_id||
    pagetitle==page_id||

    instead of

    pagetitle
    pagetitle
    pagetitle

    I just want to show the pagetitle in a TV options while editing a document and when selected, I will use the corresponding ID in the ditto call.

    Can anybody help me with this?

    Thanks.
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 4310
      • 2,310 Posts
      If you want the pagetitle only, try =>
      @SELECT pagetitle FROM [+PREFIX+]site_content WHERE parent = 123
      

      That will output a drop down list of pagetitles.
        • 33337
        • 3,975 Posts
        Actually i want to have both.

        eg. if pagetitle changes, but id remains the same.

        Got my point?
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 4310
          • 2,310 Posts
          Ah I think I see what you mean, a drop down list with the pagetitles but when selected the value stored would be the id.
          I’ve seen something like this somewhere on the forums.
            • 11975
            • 2,542 Posts
            Hi,


            @SELECT pagetitle,id FROM [+PREFIX+]site_content WHERE parent = 123

            will do the trick

            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 33337
              • 3,975 Posts
              Thanks a lot Helio!
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link
                • 4310
                • 2,310 Posts
                My thanks to, that’s handy for keeping it easy for the client.