Once I made the change the staff member ID auto saved the staff members categories table correctly.
{
"formtabs":[
{
"MIGX_id":8,
"caption":"Staff Categories",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":17,
"field":"category_id",
"caption":"Category",
"description":"",
"description_is_code":"0",
"inputTV":"staff_categories",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
}
],
"pos":1
}
],
"contextmenus":"update||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"staff_member_categories",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"staff",
"classname":"StaffMemberCategories",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":2,
"check_resid":"0",
"check_resid_TV":"",
"join_alias":[
{
"alias":"StaffMembers"
}
],
"has_jointable":"no",
"getlistwhere":"",
"joins":[
{
"alias":"StaffCategories"
}
],
"hooksnippets":"",
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Staff ID",
"dataIndex":"staff_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"Category ID",
"dataIndex":"category_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"Staff Table ID",
"dataIndex":"StaffMembers_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"Staff Name",
"dataIndex":"StaffMembers_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":6,
"header":"Category Name",
"dataIndex":"StaffCategories_category",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}This question has been answered by Bruno17. See the first response.
Is it this schema from the first post, which you are working with?
https://forums.modx.com/thread/96409/help-with-simple-many-to-many-nested-migxdb-cmp#dis-post-521761
{
"formtabs":[
{
"MIGX_id":88,
"caption":"Staff Categories",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":387,
"field":"category_id",
"caption":"Category",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@EVAL return 'Select One==||' . $modx->runSnippet('migxLoopCollection',array('packageName'=>'staff','classname'=>'StaffCategory','tpl'=>'@CODE:[[+category]]==[[+id]]','outputSeparator'=>'||'));",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
}
],
"pos":1
}
],
"contextmenus":"update||remove",
"actionbuttons":"addItem",
"columnbuttons":"update||remove",
"filters":"",
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"staff_member_categories",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"staff",
"classname":"StaffMemberCategories",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":2,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"StaffMembers",
"has_jointable":"no",
"getlistwhere":"",
"joins":[
{
"alias":"StaffCategories"
}
],
"hooksnippets":{
"aftersave":"staff_member_categories_aftersave"
},
"cmpmaincaption":"",
"cmptabcaption":"",
"cmptabdescription":"",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":1,
"header":"ID",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":2,
"header":"Staff ID",
"dataIndex":"staff_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"Category ID",
"dataIndex":"category_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"Staff Table ID",
"dataIndex":"Joined_id",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"Staff Name",
"dataIndex":"Joined_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":6,
"header":"Category Name",
"dataIndex":"StaffCategories_category",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}
"check_resid":1,
"join_alias":"StaffMembers",
"has_jointable":"no",
"joins":[
{
"alias":"StaffCategories"
}
],
"hooksnippets":{
"aftersave":"staff_member_categories_aftersave"
},this should do it:
But what does "check_resid" mean?
And why do we need $postvalues and $configs variables in staff_member_categories_aftersave snippet?
{
"MIGX_id":3,
"header":"Joined",
"dataIndex":"joined",
"width":10,
"sortable":"false",
"show_in_grid":1,
"renderer":"this.renderSwitchStatusOptions",
"clickaction":"switchOption",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":[
{
"MIGX_id":1,
"name":"joined",
"use_as_fallback":"",
"value":1,
"clickaction":"",
"handler":"",
"image":"assets\/components\/migx\/style\/images\/cb_ticked.png"
},
{
"MIGX_id":2,
"name":"unjoined",
"use_as_fallback":1,
"value":"0",
"clickaction":"",
"handler":"",
"image":"assets\/components\/migx\/style\/images\/cb_empty.png"
}
],
"editor":""
},
"extrahandlers":"this.handleColumnSwitch",
Now it becomes more clear.$scriptProperties['idx']
$modx->migx->customconfigs