We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36926
    • 701 Posts
    Hello,

    Anyone know if it’s pobbible to generate a TV dropdown list from the children of containing folder?

    Thanks

    Ben
      • 4310
      • 2,310 Posts
      Create your TV as type DropDown List Menu
      In the Input Option Values filed add =>
      @SELECT pagetitle,pagetitle FROM modx_site_content WHERE parent = **

      Where ** is the id of the container/parent document
        • 36926
        • 701 Posts
        Quote from: bunk58 at Sep 25, 2009, 11:21 AM

        Create your TV as type DropDown List Menu
        In the Input Option Values filed add =>
        @SELECT pagetitle,pagetitle FROM modx_site_content WHERE parent = **

        Where ** is the id of the container/parent document

        Thanks for this David, works great for generating the list. But I have a slight problem. What i’ve is have the drop down name as the pagetitle and the value set so it uses the content of that page. The only problem I now have is if I amend the content of one of the child doc’s the new content isn’t picked up but any documents that pull in that TV. I’ve tried clearing site cache and unchecking cachable on the child documents and the document that uses the TV but no luck. The only way to do it, is to actually go in and edit the document again and also each time you go in to edit the document it loses value selected from the drop down, so you have to reassign.

        Any ideas of how to avoid this.

        Thanks again

        Ben
          • 4310
          • 2,310 Posts
          Ben,
          That’s because when you select the value for the TV it is stored in the DB table for the TV, so any changes you make later to the original source of the content won’t change the stored value for that TV.
            • 36926
            • 701 Posts
            Quote from: bunk58 at Sep 26, 2009, 10:39 AM

            Ben,
            That’s because when you select the value for the TV it is stored in the DB table for the TV, so any changes you make later to the original source of the content won’t change the stored value for that TV.

            Oh ok, so is there anyway round this?

            I’ve just actually tried using the ID as the value and then used the getField snippet to pull in the content from what ever ID. Will this be heavy on the server doing it this way?

            Also is there any way of order how the list is displayed?

            Thanks

            Ben