We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6192
    • 20 Posts
    I want to create a dropdown list menu tv that retrieves a column from database.
    Here is what I have so far…

    Input Type: DropDownListMenu
    Input Option Values: @select name from modx_my_user_types
    Default Value: @select name from modx_my_user_types

    Widget: huh (Try everyone but did not work)

    What I try to create is build a input form and use this tv as one of the input field so the HTML DropDown List Menu will be populated with all the name from my custom table modx_my_user_types.

    Any help is greatly appreciated!
      • 3749
      • 24,544 Posts
      First @SELECT needs to be in upper case.

      Second, I don’t think @SELECT will work as the default value.


      You could also do this:

      @EVAL return $modx->runSnippet('GetType');


      and then create a snippet called GetType that queries the database (See the MODx DB:APO) and returns a string in the form:

      Type1||Type2||Type3 (etc).

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 6192
        • 20 Posts
        Hi BobRay,

        Thanks for your quick reply. I am still not able to get the tv to produce a HTML drop down box.
        Here is what I have tried:

        Input Type: Listbox(Single-Select)
        Input Option Values: Red==#FF0000||Green==#00FF00||Blue==#0000FF
        Default Value: Red
        Widget: HTML Entities

        What did I do wrong? I have attached the screen shoot. I know I can write a bunch of php code to get this done, but I was hoping that I don’t have to do it. Thanks for your help.
          • 4971
          • 964 Posts
          Do not use the widget, the listbox will appear automatically...
            Website: www.mercologia.com
            MODX Revo Tutorials:  www.modxperience.com

            MODX Professional Partner