We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37638
    • 63 Posts
    As I I've mentioned on Twitter, I am having a problem with a MIGX in a MIGX in a MIGX. The two comments I've gotten back basically suggest I'm crazy (fair enough, but not for this) so let me explain the setup first.

    I do lot of IT business and am looking for a better to track customer notes and assets (computers, network equipment & printers). Preferably, easily accessible on my mobile so I can get a quick summary as I'm walking in somewhere. To this end, I created a number of MIGX TVs to hold all of this information. Address, contacts, service notes, assets, etc. With all of this, I end up with a couple areas that are nested 3 times:

    Organization (MIGX level 1)
    -Computers (MIGX level 2)
    --Brand (text)
    --Model (text)
    --Nickname (text)
    --Identifiers (MIGX level 3)
    ---Identifier Type (text)
    ---Identifier (text)
    --Service Notes (MIGX level 2)
    ---Tech (text)
    ---Date (date)
    ---Notes (richtext)
    etc.

    The issue is that while I can add/edit the level 3 MIGXs, the *values* aren't saved.





    I realize that xPDO would be a more elegant/scaleable solution, but I really don't have enough records to make it worth it. I've only got about 4 hours into this so far (with frontend dev!) and I like how fast I can make changes with MIGX.

    I can also drop off a level by wiping out the first level which is basically a holder for all the rest of them -- it's there to make it pretty. But first, I want to know if this is a problem with nesting this deeply or something else.

    I can see in MySQL that this third level is being inserted into the TV, just with blank values.

    So, what is happening?

    Or better ideas?
      • 38290
      • 712 Posts
      I don't think you are crazy. This ArrayTV nesting is something that keeps me up at night as I brainstorm making ArrayTVs native in MODX (be careful what features you over-request, you'll be assigned to them).

      I assume this is a MIGX "bug". Is there anyway you could post the Input Options used to create this TV?
        jpdevries
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Hm. I've used three-level nested MIGx with no problems. However, like yourself, the top level wasn't really necessary, so I backed off to two levels just to make the JSON less complicated.

        Are you using the GUI Form Tabs, or a Config?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 37638
          • 63 Posts
          I've been building this with MyComponent, so I can upload a package if you prefer.

          Otherwise, here is Organization (jmcOrganziation), computers (jmcComputers) and identifiers (jmcIdentifiers) for examples. However, what I listed before was only a partial list: there are a whole lot more and the problem seems to reoccur every time at the same depth. I can DM an actual saved value (even though its a test env I have some real data, so I don't want to post it here).

          In all cases I'm using Form Tabs and Grid Columns only.

          jmcOrganizations:
          [{"MIGX_id":"1","caption":"Contact Info","fields":[{"MIGX_id":"1","field":"address1","caption":"Address Line 1","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"address2","caption":"Address Line 2","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"3","field":"city","caption":"City","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"4","field":"state","caption":"State","inputTV":"state","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"5","field":"zip","caption":"Zip","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"6","field":"website","caption":"Website","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"2","caption":"Organization Contacts","fields":[{"MIGX_id":"1","field":"contacts","caption":"Contacts","inputTV":"jmcContacts","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"3","caption":"Organization Assets","fields":[{"MIGX_id":"1","field":"computers","caption":"Computers","inputTV":"jmcComputers","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"3","field":"printers","caption":"Printers","inputTV":"jmcPrinters","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"networkEquipment","caption":"Network Equipment","inputTV":"jmcNetworkEquipment","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"4","caption":"Networks","fields":[{"MIGX_id":"1","field":"networks","caption":"Networks","inputTV":"jmcNetworks","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]},{"MIGX_id":"5","caption":"Global Notes","fields":[{"MIGX_id":"1","field":"serviceNotes","caption":"Service Notes","inputTV":"jmcServiceNotes","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"otherNotes","caption":"Non Tech Notes","inputTV":"jmcServiceNotes","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]}]


          jmcComputers:
          [{"MIGX_id":"1","caption":"Computers","fields":[{"MIGX_id":"1","field":"brand","caption":"Brand","inputTV":"jmcBrands","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"model","caption":"Model","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"9","field":"nickname","caption":"Nickname","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"10","field":"hostname","caption":"Hostname","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"3","field":"identifiers","caption":"Identifiers","inputTV":"jmcIdentifiers","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"4","field":"physicalLocation","caption":"Physical Location","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"5","field":"ipAddress","caption":"IP Address","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"6","field":"purchaseDate","caption":"Purchase Date","inputTV":"dateTime","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"7","field":"warrantyThrough","caption":"Warranty Through","inputTV":"dateTime","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"8","field":"jmcServiceNotes","caption":"Service Notes","inputTV":"jmcServiceNotes","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]}]


          jmcIdentifiers:
          [{"MIGX_id":"1","caption":"Identifiers","fields":[{"MIGX_id":"1","field":"identifierType","caption":"Identifier Type","inputTV":"jmcIdentifierType","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""},{"MIGX_id":"2","field":"identifier","caption":"Identifier","inputTV":"text","inputTVtype":"","configs":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":""}]}]
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Oh, dear, I was afraid of that; those are indeed Configs, and with my bad eyes they're a nightmare to read! Hopefully Bruno or another MIGx guru will be able to scan those and see if there's a problem. I'm limited to using the form tabs and grid columns fields in the input options tab of the TV.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 37638
              • 63 Posts
              @sottwell You can totally cheat. I use the configurator GUI MIGX comes with to layout the formtabs, save it, then hit 'Edit Raw'. From there I copy and paste to my TVs.

              I'm open to either easier or better ways but that's what I've come up with.
                • 4172
                • 5,888 Posts
                You know, that you don't need to create a TV for each field?
                In most cases you can set a inputTVtype.
                For Textfields you don't need any inputTV or inputTVtype. This is the default one.
                For Listboxes you can define the inputOptions inside the MIGX - configuration.
                Modified jmcOrganizations a bit.

                for example the part for the migx-TV:

                        {
                          "MIGX_id":1,
                          "field":"computers",
                          "caption":"Computers",
                          "description":"",
                          "description_is_code":"0",
                          "inputTV":"",
                          "inputTVtype":"migx",
                          "configs":"jmcComputers",
                          "sourceFrom":"config",
                          "sources":"[]",
                          "inputOptionValues":"",
                          "default":""
                        }
                


                and this part in jmcComputers:
                        {
                          "MIGX_id":3,
                          "field":"identifiers",
                          "caption":"Identifiers",
                          "description":"",
                          "description_is_code":"0",
                          "inputTV":"",
                          "inputTVtype":"migx",
                          "configs":"jmcIdentifiers",
                          "sourceFrom":"config",
                          "sources":"[]",
                          "inputOptionValues":"",
                          "default":""
                        }
                



                {
                  "formtabs":[
                    {
                      "MIGX_id":1,
                      "caption":"Contact Info",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"address1",
                          "caption":"Address Line 1",
                          "inputTV":"",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":2,
                          "field":"address2",
                          "caption":"Address Line 2",
                          "inputTV":"",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":3,
                          "field":"city",
                          "caption":"City",
                          "inputTV":"",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":4,
                          "field":"state",
                          "caption":"State",
                          "inputTV":"",
                          "inputTVtype":"listbox",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"@EVAL return $modx->runSnippet('getStatesOptions');",
                          "default":""
                        },
                        {
                          "MIGX_id":5,
                          "field":"zip",
                          "caption":"Zip",
                          "inputTV":"",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":6,
                          "field":"website",
                          "caption":"Website",
                          "inputTV":"",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    },
                    {
                      "MIGX_id":2,
                      "caption":"Organization Contacts",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"contacts",
                          "caption":"Contacts",
                          "inputTV":"jmcContacts",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    },
                    {
                      "MIGX_id":3,
                      "caption":"Organization Assets",
                      "print_before_tabs":"0",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"computers",
                          "caption":"Computers",
                          "description":"",
                          "description_is_code":"0",
                          "inputTV":"",
                          "inputTVtype":"migx",
                          "configs":"jmcComputers",
                          "sourceFrom":"config",
                          "sources":"[]",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":3,
                          "field":"printers",
                          "caption":"Printers",
                          "inputTV":"jmcPrinters",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":2,
                          "field":"networkEquipment",
                          "caption":"Network Equipment",
                          "inputTV":"jmcNetworkEquipment",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    },
                    {
                      "MIGX_id":4,
                      "caption":"Networks",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"networks",
                          "caption":"Networks",
                          "inputTV":"jmcNetworks",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    },
                    {
                      "MIGX_id":5,
                      "caption":"Global Notes",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"serviceNotes",
                          "caption":"Service Notes",
                          "inputTV":"jmcServiceNotes",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":2,
                          "field":"otherNotes",
                          "caption":"Non Tech Notes",
                          "inputTV":"jmcServiceNotes",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    }
                  ],
                  "contextmenus":"",
                  "actionbuttons":"",
                  "columnbuttons":"",
                  "filters":"[]",
                  "extended":{
                    "migx_add":"",
                    "formcaption":"",
                    "update_win_title":"",
                    "win_id":"jmcOrganizations",
                    "multiple_formtabs":"",
                    "extrahandlers":"",
                    "packageName":"",
                    "classname":"",
                    "task":"",
                    "getlistsort":"",
                    "getlistsortdir":"",
                    "use_custom_prefix":"0",
                    "prefix":"",
                    "grid":"",
                    "gridload_mode":1,
                    "check_resid":1,
                    "check_resid_TV":"",
                    "join_alias":"",
                    "getlistwhere":"",
                    "joins":"",
                    "cmpmaincaption":"",
                    "cmptabcaption":"",
                    "cmptabdescription":"",
                    "cmptabcontroller":""
                  },
                  "columns":[
                    {
                      "MIGX_id":1,
                      "header":"Address",
                      "dataIndex":"address1",
                      "width":"",
                      "sortable":"false",
                      "show_in_grid":1,
                      "renderer":"",
                      "clickaction":"",
                      "selectorconfig":"",
                      "renderoptions":"[]"
                    }
                  ]
                }
                


                jmcComputers:

                {
                  "formtabs":[
                    {
                      "MIGX_id":1,
                      "caption":"Computers",
                      "print_before_tabs":"0",
                      "fields":[
                        {
                          "MIGX_id":1,
                          "field":"brand",
                          "caption":"Brand",
                          "inputTV":"jmcBrands",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":2,
                          "field":"model",
                          "caption":"Model",
                          "inputTV":"text",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":9,
                          "field":"nickname",
                          "caption":"Nickname",
                          "inputTV":"text",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":10,
                          "field":"hostname",
                          "caption":"Hostname",
                          "inputTV":"text",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":3,
                          "field":"identifiers",
                          "caption":"Identifiers",
                          "description":"",
                          "description_is_code":"0",
                          "inputTV":"",
                          "inputTVtype":"migx",
                          "configs":"jmcIdentifiers",
                          "sourceFrom":"config",
                          "sources":"[]",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":4,
                          "field":"physicalLocation",
                          "caption":"Physical Location",
                          "inputTV":"text",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":5,
                          "field":"ipAddress",
                          "caption":"IP Address",
                          "inputTV":"text",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":6,
                          "field":"purchaseDate",
                          "caption":"Purchase Date",
                          "inputTV":"dateTime",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":7,
                          "field":"warrantyThrough",
                          "caption":"Warranty Through",
                          "inputTV":"dateTime",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        },
                        {
                          "MIGX_id":8,
                          "field":"jmcServiceNotes",
                          "caption":"Service Notes",
                          "inputTV":"jmcServiceNotes",
                          "inputTVtype":"",
                          "configs":"",
                          "sourceFrom":"config",
                          "sources":"",
                          "inputOptionValues":"",
                          "default":""
                        }
                      ]
                    }
                  ],
                  "contextmenus":"",
                  "actionbuttons":"",
                  "columnbuttons":"",
                  "filters":"[]",
                  "extended":{
                    "migx_add":"",
                    "formcaption":"",
                    "update_win_title":"",
                    "win_id":"jmcComputers",
                    "multiple_formtabs":"",
                    "extrahandlers":"",
                    "packageName":"",
                    "classname":"",
                    "task":"",
                    "getlistsort":"",
                    "getlistsortdir":"",
                    "use_custom_prefix":"0",
                    "prefix":"",
                    "grid":"",
                    "gridload_mode":1,
                    "check_resid":1,
                    "check_resid_TV":"",
                    "join_alias":"",
                    "getlistwhere":"",
                    "joins":"",
                    "cmpmaincaption":"",
                    "cmptabcaption":"",
                    "cmptabdescription":"",
                    "cmptabcontroller":""
                  },
                  "columns":[
                    {
                      "MIGX_id":1,
                      "header":"Brand",
                      "dataIndex":"brand",
                      "width":"",
                      "sortable":"false",
                      "show_in_grid":1,
                      "renderer":"",
                      "clickaction":"",
                      "selectorconfig":"",
                      "renderoptions":"[]"
                    }
                  ]
                }
                


                seems to work great. This is the result:

                Array
                (
                    [MIGX_id] => 1
                    [address1] => address1
                    [address2] => 
                    [city] => 
                    [state] => 
                    [zip] => 
                    [website] => 
                    [contacts] => 
                    [computers] => [{"MIGX_id":"1","brand":"brand1","model":"","nickname":"","hostname":"","identifiers":"[{\"MIGX_id\":\"1\",\"identifierType\":\"\",\"identifier\":\"test\"},{\"MIGX_id\":\"2\",\"identifierType\":\"\",\"identifier\":\"identifier2\"}]","physicalLocation":"","ipAddress":"","purchaseDate":"","warrantyThrough":"","jmcServiceNotes":""},{"MIGX_id":"2","brand":"brand2","model":"","nickname":"","hostname":"","identifiers":"[{\"MIGX_id\":\"1\",\"identifierType\":\"identifier3\",\"identifier\":\"\"}]","physicalLocation":"","ipAddress":"","purchaseDate":"","warrantyThrough":"","jmcServiceNotes":""}]
                    [printers] => 
                    [networkEquipment] => 
                    [networks] => 
                    [serviceNotes] => 
                    [otherNotes] => 
                    [_alt] => 0
                    [_first] => 1
                    [_last] => 
                    [idx] => 1
                    [property.tvname] => jmcOrganizations
                )
                
                Array
                (
                    [MIGX_id] => 2
                    [address1] => address2
                    [address2] => 
                    [city] => 
                    [state] => 
                    [zip] => 
                    [website] => 
                    [contacts] => 
                    [computers] => [{"MIGX_id":"1","brand":"brand1","model":"","nickname":"","hostname":"","identifiers":"[{\"MIGX_id\":\"1\",\"identifierType\":\"\",\"identifier\":\"test\"},{\"MIGX_id\":\"2\",\"identifierType\":\"\",\"identifier\":\"identifier2\"}]","physicalLocation":"","ipAddress":"","purchaseDate":"","warrantyThrough":"","jmcServiceNotes":""},{"MIGX_id":"2","brand":"brand2","model":"","nickname":"","hostname":"","identifiers":"[{\"MIGX_id\":\"1\",\"identifierType\":\"\",\"identifier\":\"identifier4\"},{\"MIGX_id\":\"2\",\"identifierType\":\"\",\"identifier\":\"identifier5\"}]","physicalLocation":"","ipAddress":"","purchaseDate":"","warrantyThrough":"","jmcServiceNotes":""}]
                    [printers] => 
                    [networkEquipment] => 
                    [networks] => 
                    [serviceNotes] => 
                    [otherNotes] => 
                    [_alt] => 1
                    [_first] => 
                    [_last] => 1
                    [idx] => 2
                    [property.tvname] => jmcOrganizations
                )
                
                


                I'm using the latest MIGX - version from github. Not sure, if the version can be an issue.
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 37638
                  • 63 Posts
                  That is awesome Bruno, thanks!

                  I didn't know that MIGX could just use the TV Type, I thought each field actually needed a TV. I'll try this all out this weekend, when I am done working on other peoples' stuff.
                    • 37638
                    • 63 Posts
                    Ok, so I made those changes and no dice. Finally, I tried doing this within the MIGX configurator and had the same problem:



                    I'll try upgrading MODX and getting a github copy of MIGX (or the latest beta on there) and see what happens.

                    Again, thanks for all your help!
                      • 4172
                      • 5,888 Posts
                      I'm hoping you are lucky and it was an issue with your version of MIGX.
                      Have seen this issue some times before, but not lastly on my current version.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!