We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38440
    • 18 Posts
    Hi there, wondering if anyone can help! I've searched through the forums and tried everything I can think of but can't solve the problem I'm having with MIGX multiple forms.

    I'm trying to put together a very simple price list table using MIGX. The list is split into categories, so I want some of the lines in the list to be the category headings and others to be the actual items - so display an item name and an item price.

    I thought the best way to do this would be to use 2 forms - one for the heading items and one for the actual prcie list items, the problem is that when I set the form tabs for multiple forms it just doesn't render - just give s blank page (see screenshot):



    the JSON I am using is:

    [{
    [{"formname":"Items", "formtabs":
    [
    {"caption":"Item", "fields": [
    {"field":"itemName","caption":"Price List Item Name","inputTV":"PriceListItemTNameTV"},{"field":"itemPrice","caption":"Price List Item Price","inputTV":"PriceListItemPriceTV"}
    ]}
    ]
    },{"formname":"Headings", "formtabs":
    [
    {"caption":"Heading", "fields": [
    {"field":"heading","caption":"Section Title","inputTV":"PriceListSecTitleTV"}
    ]}
    ]
    }]
    }]

    When just using a single form like so:

    [
    {"caption":"Item Name", "fields": [
    {"field":"PriceListItemTNameTV","caption":"Price List Item Name","inputTV":"PriceListItemTNameTV"},{"field":"PriceListItemPriceTV","caption":"Price List Item Price","inputTV":"PriceListItemPriceTV"}
    ]}
    ]

    It renders fine (screenshot) -



    but not with multiple forms. I really can't ficure out what is happening..

    Thanks for you help:

    Superchilled
      • 4172
      • 5,888 Posts
      does this work?

      [
      {"formname":"Items", "formtabs":[
      {"caption":"Item", "fields": [
      {"field":"itemName","caption":"Price List Item Name","inputTV":"PriceListItemTNameTV"},{"field":"itemPrice","caption":"Price List Item Price","inputTV":"PriceListItemPriceTV"}
      ]}
      ]
      },
      {"formname":"Headings", "formtabs":[
      {"caption":"Heading", "fields": [
      {"field":"heading","caption":"Section Title","inputTV":"PriceListSecTitleTV"}
      ]}
      ]}
      ]
      



      you can also create nested MIGX - TVs

      The outer MIGX - TV for categories.
      The inner MIGX - TV for the price - items inside the categories.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 38440
        • 18 Posts
        Hi Bruno,

        thanks for responding so quickly!

        Yep, that's worked perfectly, thanks. smiley

        I hadn't thought of nesting the TVs (it's the first time I've used MIGX and I thought I'd keep things simple!) but it might actually be a better way to go. Is there any documentation on how to do this? I'm assuming you create two MIGX TVs, and the TV that you reference the inner TV as the inputTV for the Outer TV?

        thanks again.

        Superchilled
          • 4172
          • 5,888 Posts
          I'm assuming you create two MIGX TVs, and the TV that you reference the inner TV as the inputTV for the Outer TV?


          yes, this is one way, which should work.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 38440
            • 18 Posts
            Quote from: Bruno17 at Apr 07, 2013, 03:28 PM


            yes, this is one way, which should work.

            Thanks! I'll give it a try.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I have one site where I've been playing with MIGx nested three deep. If you like, I can post the form tab and grid configurations as well as the chunk tpls for output.
                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
                • 38440
                • 18 Posts
                Hi Sottwell,

                yes, that would be really helpful, thanks!
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Ok... I did modify it a bit because while the three levels was clever, I decided that since the top level was only four items and would not change, I would use four two-level MIGx TVs instead.

                  Outer level TV switchesGroupTV (all four are the same, just the first part of the name is changed):
                  Fields:
                  [
                  {"caption":"Product Groups", "fields": [
                      {"field":"group","caption":"Group"},
                      {"field":"links","caption":"Links","inputTV":"productLinksTV"}
                  ]}
                  ]
                  Grid:
                  [
                  {"header": "Group", "width": "160", "sortable": "true", "dataIndex": "group"}
                  ]
                  

                  Inner level TV productLinksTV (the same for all groups):
                  Fields:
                  [
                  {"caption":"Download Links", "fields": [
                      {"field":"linktext","caption":"Link Text"},
                      {"field":"link","caption":"Link URL"},
                      {"field":"type","caption":"File type"}
                  ]}
                  ]
                  Grid:
                  [
                  {"header": "Link Text", "width": "200", "sortable": "true", "dataIndex": "linktext"},
                  {"header": "Link URL", "width": "400", "sortable": "false", "dataIndex": "link"}
                  ]
                  

                  The snippet call:
                  <ul>
                  [[getImageList? &tvname=`switchesGroupTV` &tpl=`productGroupsTpl`]]
                  </ul>
                  

                  productGroupsTpl (note that it uses the name of the field for the inner TV):
                  <li>[[+group]]
                    <ul>
                      [[getImageList? &value=`[[+links]]` &tpl=`productLinksTpl`]]
                    </ul>
                  </li>
                  

                  And productLinksTpl:
                  <li>
                    <a href="[[+link]]">[[+linktext]]</a>
                  </li>
                  
                    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
                    • 38440
                    • 18 Posts
                    Thanks Sottwell. That's a great help!
                      • 38440
                      • 18 Posts
                      Hi Sottwell/ Bruno/ anyone else. The code provided so far has helped a lot, but I have another question. Just wondering if it is possible to pull a value from the outer tv into the inner tv?

                      For example, if I wanted to create a group of galleries and use the other tv to give the gallery name among other things, but then wanted to apply the same name value to all the inner tv items for that gallery, is this possible?

                      Thanks.

                      Superchilled.