We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20648
    • 26 Posts
    In my document tree I have several folders that contain subfolders.

    Typical
    Services
    sub services 1.1
    sub services 1.1.1
    sub services 1.1.1.1
    sub services 1.1.1.2
    sub services 1.1.2

    sub services 1.2
    sub services 1.2.1
    sub services 1.2.2

    and so on...

    What I would like is to populate the whole "services tree" into a dropdown list (dynamically, of course). Actually I need 4 dropdowns, one for each sub service. This will serve as “quick links” on my site.
    Also, when the user select a service in the dropdown list, it "redirects" the user to the chosen service, without pressing a submit button.

    I have search the community up and down, but I can’t find anything that can give me a hint.

    The only one near was this thread, but that did not work.
    http://modxcms.com/forums/index.php?PHPSESSID=0184ab1882eb5ca8455787dd7a880aa7&topic=7235.msg51896

    Is it possible to use Ditto in my case?
    Is this extremely difficult with modX or is it just me...? I guess it is me. I’m no coder so I hope that someone can give me a working example on how to achieve this.
      • 7260
      • 107 Posts
      Ditto is supposed be the latest
      but there is drop menu
      and Way finder

      Here is a good intro I spent today looking at in fact..

      -http://www.muddydogpaws.com/notebook/wayfinder-10.html
      (view examples at the bottom of waht can be done)

      Have you successfully called a snippet yet to show your document tree yet?
      Evetually you may want to put it in your template or something , but for now on one of your documents just
      Put
      [[DropMenu]]

      or
      [[Wayfinder]]

      or whichever snippet you decide to use (and have in your snippet collection)

      Keep reading the documentation it will make sense. What Im learning is that its far easier than it first appears.
      ps
      (I found DropMenu the easiest to start off testing with)

      A lot will of course depend on your CSS styling..too.
      are you comfortably familiar with it?
        • 11975
        • 2,542 Posts
        Hi,

        I’ve answered a similar question here ==> http://modxcms.com/forums/index.php/topic,10983.msg74306.html#msg74306


        :-)
          Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
          • 20648
          • 26 Posts
          Hi, and thanks for the answers.

          Jepp, that worked smiley Thank’s again for quick response.

          One question: I want 4 dropdowns on the same page. When i set up the four wayfinder call with different startID, it does not work. I know it is because I have to use unique formnames. As you can se below, I use some javascript to process the selected value. I have tried to use parameters to name each form differently, i.e [+wf.classnames+]. But that did not work. I also know that I can make 4 templates (for each form). But is it a more elegant way of doing it?


          My outerTpl
          <form action="" name="testForm">
          <select name="testSelect" class="selectService"  OnChange="location.href=testForm.testSelect.options[selectedIndex].value" >
          <option value="[~1~]" selected="selected">Choose a service:</option>
          [+wf.wrapper+]
          </select>
          </form>
          


          my rowTpl
          <option value="[+wf.link+]">[+wf.title+]</option>
          


          my Wayfinder call
          [[Wayfinder? &startId=`48` &level=`0`  &outerTpl=`ddOuterTpl` &rowTpl=`ddRowTpl` &hideSubMenus=`false`]] 


            • 11975
            • 2,542 Posts
            I guess you could try to modify your outerTpl to use outerClass to give each form an unique name.

            <form action="" name="[+wf.classnames+]">
            <select name="testSelect" class="selectService"  OnChange="location.href=[+wf.classnames+].testSelect.options[selectedIndex].value" >
            <option value="[~1~]" selected="selected">Choose a service:</option>
            [+wf.wrapper+]
            </select>
            </form>


            and change your call to

            [[Wayfinder? &startId=`48` &level=`0` &outerTpl=`ddOuterTpl` &outerClass=`testForm` &rowTpl=`ddRowTpl` &hideSubMenus=`false`]]

            This should do the trick.

            :-)

            EDIT: I’ve corrected the code above
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 20648
              • 26 Posts
              hi again,

              I have tried this, but look at my source code... In theory your solution should work, but...

              <form action="" name="">
              <select name="testSelect" class="selectService"  OnChange="location.href=.testSelect.options[selectedIndex].value" >
              <option value="index.html" selected="selected">Choose a service:</option>
              
              <option value="/modx/service/subservice1.html">subservice1</option>
              <option value="/modx/service/subservice2.html">subservice2</option>
              <option value="/modx/service/subservice3.html">subservice3</option>
              <option value="/modx/service/subservice4.html">subservice4</option>
              <option value="/modx/service/subservice5.html">subservice5</option>
              <option value="/modx/service/subservice6.html">subservice6</option>
              
              </select>
              </form>
              


              As you can se it does not output the name="[+wf.classnames+]" and neither in the javascript href.
                • 11975
                • 2,542 Posts
                Sounds like a bug.

                In wayfinder.inc.php

                Change in function buildMenu line 190

                $phArray = array($output,$useClass);

                to

                $phArray = array($output,$useClass,$classNames);

                It worked for me

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 20648
                  • 26 Posts
                  :) perfect.

                  You are genius. Thank you!