Can MIGX multiple formtabs (a form switching setup) be imported?

I was trying to create a MIGX form where the user starts with adding an item to the main TV.

  1. Bring up a select box to choose a layout (1 column, 2 column, etc).
  2. Then select the item that goes into those columns (Text, Image, Video, etc).

So I was wanting to create a form switcher for the Text, Image, Video forms. The A.I. engines don’t seem to know how to do this. Both Gemini and CoPilot suggest going to the Multiform Tab. When explaining there is no Multiform Tab they offer to provide some JSON to paste in to create the full configuration. This doesn’t work either.

I did find the multiform select box on the regular forms tab. which seems to require existing top level forms to build a multi-form configuration. I built a couple mockup forms to test this out and then looked at the JSON which appears to crate the forms with MIGX configuration ID numbers.

Those ID numbers will be different in every setup, so my question is: is it not possible to have a JSON that can import the entire multi form or form-switching configuration?

I don’t really understand your question.

I guess what you describe is the functionality explained here in the MIGX tutorial → MIGX.Varying layout-boxes. So are you testing this version or the Configurator-Version?

And what exactly do you want to import? The MIGX-configs? The data of the MIGX TV?

The main question was whether or not there was a way to import the entire form preconfigured by the JSON. Looking at that tutorial it looks like it must not be possible from the configurator. Gemini and CoPilot seemed to think it was, but every time I tried their suggestions it would fail. It looks like you have to create each form separately and then manually pick them from the Multiple Formtabs dropdown.

It adds this in the JSON. Those ID numbers will vary depending on other things already built inside MIGX configurator.

"multiple_formtabs":"1||2||3",

If I try to change that to the form names it breaks.

"multiple_formtabs":"layout_1||layout_2||layout_3",

So trying to import the entire JSON from the configurator like this doesn’t seem possible without pre-creating the forms and knowing the form IDs.

{
  "formtabs":[
    {
      "caption":"Row Format",
      "fields":[
        {
          "field":"fake",
          "inputTVtype":"hidden",
          "pos":1,
          "MIGX_id":1
        },
        {
          "field":"cell_2_image",
          "caption":"Image",
          "inputTVtype":"hidden",
          "pos":2,
          "MIGX_id":2
        },
        {
          "field":"cell_2_headline",
          "caption":"Headline",
          "inputTVtype":"hidden",
          "pos":3,
          "MIGX_id":3
        },
        {
          "field":"cell_2_content",
          "caption":"Content",
          "inputTVtype":"hidden",
          "pos":4,
          "MIGX_id":4
        },
        {
          "field":"cell_3_image",
          "caption":"Image",
          "inputTVtype":"hidden",
          "pos":5,
          "MIGX_id":5
        },
        {
          "field":"cell_3_headline",
          "caption":"Headline",
          "inputTVtype":"hidden",
          "pos":6,
          "MIGX_id":6
        },
        {
          "field":"cell_3_content",
          "caption":"Content",
          "inputTVtype":"hidden",
          "pos":7,
          "MIGX_id":7
        }
      ],
      "pos":1,
      "MIGX_id":1
    },
    {
      "caption":"First",
      "fields":[
        {
          "field":"cell_1_image",
          "caption":"Image",
          "inputTVtype":"image",
          "pos":1,
          "MIGX_id":8
        },
        {
          "field":"cell_1_headline",
          "caption":"Headline",
          "pos":2,
          "MIGX_id":9
        },
        {
          "field":"cell_1_content",
          "caption":"Content",
          "inputTVtype":"richtext",
          "pos":3,
          "MIGX_id":10
        }
      ],
      "pos":2,
      "MIGX_id":2
    }
  ],
  "contextmenus":"",
  "actionbuttons":"",
  "columnbuttons":"",
  "filters":"",
  "extended":{
    "migx_add":"",
    "disable_add_item":"",
    "add_items_directly":"",
    "formcaption":"",
    "update_win_title":"",
    "win_id":"layout_1",
    "maxRecords":"",
    "addNewItemAt":"bottom",
    "media_source_id":"",
    "multiple_formtabs":"1||2||3",
    "multiple_formtabs_label":"",
    "multiple_formtabs_field":"",
    "multiple_formtabs_optionstext":"",
    "multiple_formtabs_optionsvalue":"",
    "actionbuttonsperrow":4,
    "winbuttonslist":"",
    "extrahandlers":"",
    "filtersperrow":4,
    "packageName":"",
    "classname":"",
    "task":"",
    "getlistsort":"",
    "getlistsortdir":"",
    "sortconfig":"",
    "gridpagesize":"",
    "use_custom_prefix":"0",
    "prefix":"",
    "grid":"",
    "gridload_mode":1,
    "check_resid":1,
    "check_resid_TV":"",
    "join_alias":"",
    "has_jointable":"yes",
    "getlistwhere":"",
    "joins":"",
    "hooksnippets":"",
    "cmpmaincaption":"",
    "cmptabcaption":"",
    "cmptabdescription":"",
    "cmptabcontroller":"",
    "winbuttons":"",
    "onsubmitsuccess":"",
    "submitparams":""
  },
  "permissions":{
    "apiaccess":"",
    "view":"",
    "list":"",
    "save":"",
    "create":"",
    "remove":"",
    "delete":"",
    "publish":"",
    "unpublish":"",
    "viewdeleted":"",
    "viewunpublished":""
  },
  "fieldpermissions":"",
  "columns":[
    {
      "header":"Row Format",
      "width":30,
      "sortable":true,
      "dataIndex":"MIGX_formname"
    },
    {
      "header":"First",
      "width":160,
      "sortable":"false",
      "dataIndex":"cell_1_image",
      "renderer":"this.renderImage"
    },
    {
      "header":"Second",
      "width":160,
      "sortable":"false",
      "dataIndex":"cell_2_image",
      "renderer":"this.renderImage"
    },
    {
      "header":"Third",
      "width":160,
      "sortable":"false",
      "dataIndex":"cell_3_image",
      "renderer":"this.renderImage"
    }
  ],
  "category":""
}

Also when I follow that tutorial, the preview button doesn’t work. It just shows the last queries line from the template, but none of the MIGX content.

Yes, when you use the “Configurator-Version”, then the “multiple_formtabs” field will contain the IDs of the other MIGX-configs you’re referencing and not the config names.

So when you try to import the configs as JSON from another MODX installation, the IDs won’t necessarily match (because the id column of the database table modx_migx_configs is an autoincrement primary key). You’ll have to change the value manually after the import (or write a custom script that does the change.)


If you use the other version of the tutorial, then it should work. Because all the information for the different formtabs is just stored in the “Form Tabs” field of the TV.