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

    I want to know the method that how can I populate my select drop down with data of my registered users in MIGX form creator.

    I have tbl_registered_user and i want to get data as Full Name and user_id and populate select dropdown instead of text field with user data.

    Thnx
      • 4172
      • 5,888 Posts
      inputTVtype: listbox

      input option values: @CHUNK getUserList


      and create a chunk getUserList with:
      [[migxLoopCollection?
      &classname=`modUserProfile`
      &tpl=`@CODE:[[+fullname]]==[[+internalKey]]`
      &outputSeparator=`||`
      ]]


      you can try this snippet-call at frontend, before using it for the input-options, if it returns what you need.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 48305
        • 58 Posts
        Where should I put this code? Cause it didn't get location where that form is being created. I need this on backend modx manager..

        Thnx [ed. note: mujtabaahmad1985 last edited this post 12 years, 2 months ago.]
          • 4172
          • 5,888 Posts
          Didn't you create a MIGX-configuration in the MIGX-Configuration-CMP?

          Components->MIGX
          Tab MIGX

          right-click on your configuration in the grid -> edit

          tab formtabs

          there are the tabs for your form with their fields

          edit your field
          Tab 'Input Options'
          field 'Input Option Values'

          here put:
          @CHUNK getUserList


          and create that chunk with the migxLoopCollection-snippet-call
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 48305
            • 58 Posts
            I want to fetch user from my custom table like tbl_useraccounts.. then what will be class in this case.... cause users are being registered via my custom coding not using any plugin.....
              • 4172
              • 5,888 Posts
              you should create a xpdo-schema and a package for your custom-table(-set), if you haven't allready

              then you can do

              [[migxLoopCollection?
              &packageName=`yourpackage`
              &classname=`yourClass`
              &tpl=`@CODE:[[+fullname]]==[[+id]]`
              &outputSeparator=`||`
              ]]


              or you can try the @SELECT-binding
              http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/bindings/select-binding

                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 48305
                • 58 Posts
                Select binding is working fine. But when i save some data against dropdown it saves client name as key, check in attach document
                  • 4172
                  • 5,888 Posts
                  whats your current select-binding, please?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 48305
                    • 58 Posts
                    @SELECT `user_name` AS `name`,`user_id` FROM `[[+PREFIX]]useraccounts`

                    I just put this line into inputOption -> Value
                      • 4172
                      • 5,888 Posts
                      try

                      @SELECT `user_name` AS `name` FROM `[[+PREFIX]]useraccounts` 


                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!