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

    I’m trying to create a simple CRM as exercise to learn Modx (revolution).
    I created two containers:

    - People
    - Companies

    And may documents for each category.


    When editing people, I’d like to have listbox populated with all the companies previously entered. Then i should select the company or companies associated with that person. I just need the names of the companies.

    I think I should use a TV with @EVAL, but currently but how can i do this?

      • 4310
      • 2,310 Posts
      Have a look at this thread.
      It should point you in the right direction
        • 4971
        • 964 Posts
        Yep, or @SELECT will do the trick, do a query to select the value
        that you want. I usually use the page title but you could use any
        other value of the People or Company page.
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 2206
          • 22 Posts
          I took the code in the link and modified it changing che placeholder syntax and the parnt resource ID

          @SELECT pagetitle, id FROM ( (SELECT pagetitle, id, menuindex FROM [[+PREFIX]]site_content WHERE parent = 3) UNION (SELECT ’@INHERIT’, ’@INHERIT’, 9999) ORDER BY menuindex) as sc

          Then I created a new drop down list and put the code in the Input Option Value field

          Unfortunately the result is just a blank drop down menu.

          I also tried a simpler query: @SELECT pagetitle FROM [[+PREFIX]]site_content WHERE parent = 3

          With no results.

          Any suggestion? huh
            • 33337
            • 3,975 Posts
            i think PREFIX is something else. Cant recall now though :/
              Zaigham R - MODX Professional | Skype | Email | Twitter

              Digging the interwebs for #MODX gems and bringing it to you. modx.link
              • 4310
              • 2,310 Posts
              @SELECT pagetitle FROM modx_site_content WHERE parent = 3
                • 2206
                • 22 Posts
                @bunk58

                Thank you for the code.

                Unfortunalely it doesn’y work at all - the dropdown list is empty

                Is it possiblle that @select populates dropdown lists only in evolution? (i’m using revolution)
                  • 4310
                  • 2,310 Posts
                  It was for Evolution.
                  Personally, I think we’re going to need the forum splitting into two areas.
                  Otherwise there’s likely to be a lot of time and effort wasted sad
                    • 2206
                    • 22 Posts
                    Quote from: bunk58 at Nov 10, 2009, 07:40 AM

                    It was for Evolution.
                    Personally, I think we’re going to need the forum splitting into two areas.
                    Otherwise there’s likely to be a lot of time and effort wasted sad

                    Totally agree. Since revolution is getting more popular finding information could be very difficult
                      • 20364
                      • 89 Posts
                      Any idea how the statement would look for Revolution?

                      @SELECT pagetitle FROM modx_site_content WHERE parent = 3

                      Edit:

                      When looking at the Revo database. There is still a ’modx_site_content’ table with the fields ’pagetitle’ and ’parent’ ... should still work?

                      Edit 2:

                      Made a touch of progress. When I use this:

                      @SELECT pagetitle FROM modx_site_content WHERE parent = 3

                      It outputs this:

                      <select id="tv9" style="width: 300px;" size="8" onchange="MODx.fireResourceFormChange();" multiple="multiple" name="tv9[]">
                      <option selected="selected" value=""/>
                      <option selected="selected" value=""/>
                      </select>

                      It is PROPERLY grabbing 2 <options> because that is how many elements there are under that parent. When I add an element, it grabs 3.

                      So, the challenge I am facing now is how to get it to grab the proper data and populate the <option> tags right.