MODX Community

Get Childids in MIGX Formulier tabs

Hi All,

I have a MIGX variable where i have to get the childs of a parent ID 3, in my call in formulier tabs I can only put hard coded. (eg. see numbers 7,14,15,39,120,132) they are the childs of parent ID 3, now if i make a new child, i have to add them manually. How can I call them of the parent ID 3 ??

[
{"caption":"Info", "fields": [
    {"field":"titel","caption":"Titel"},
	{"field":"titel-plaatsen","caption":"Titel plaatsen","inputTVtype":"listbox","inputOptionValues":"Ja==ja||Nee==nee"},
	{"field":"slogan","caption":"Slogan"},
    {"field":"slogan-plaatsen","caption":"Slogan plaatsen","inputTVtype":"listbox","inputOptionValues":"Ja==ja||Nee==nee"},
	{"field":"link-plaatsen","caption":"Verwijs pagina plaatsen ??","inputTVtype":"listbox","inputOptionValues":"Nee==nee||Ja==ja"},
	{"field":"link-aan","caption":"Kies verwijs pagina","inputTVtype":"listbox","inputOptionValues":"@EVAL $id = $modx->resource->get('id'); return $modx->runSnippet('pdoResources', array('parents'=>'7,14,15,39,120,132', 'showUnpublished'=>'1', 'showHidden'=>'1', 'hideContainers'=>'1','tpl'=>'TVlist','tplLast'=>'TVListLast','context'=>'web', 'limit'=>'0', 'sortby'=>'pagetitle','sortdir'=>'ASC'));"}
]},
{"caption":"Afbeelding", "fields":[
	{"field":"slide-pos","caption":"Slide positie versnijding","inputTVtype":"listbox","inputOptionValues":"Centrum==C||Vanaf boven==T||Vanaf onder==B"},
	{"field":"slide-afb","caption":"Afbeelding","inputTVtype":"image","sourceFrom":"migx"}
]}
]

greetings Appeltje

are these all direct childs of the parent?

can’t you just call

array('parents'=>'3'

and remove the containers

Bruno,

I have to get the children of the parent ID 3, and they contain grandchildren which will appear in a listbox to select so id 3 is the grand parent which contain ids and their children have to be listed in a listbox to select . So the resources which are in the containers 7,14, … and so on.

So these direct childs 7, 14 … of 3 also contain children and these childs will appear in listbox

Appeltje

maybe you could remove the children, but not the grandchildren with
&hideContainers=`1`

see https://docs.modx.com/current/en/extras/pdoTools/Snippets/pdoResources

Bruno,

I’am going to try that, thanks for your reply.
Hopefully is that the solution.

Appeltje

Bruno,

It works, the solution you gave.
hidecontainers and excluded the non containers with &resources with -id

Thanks,
Greetings Appeltje

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.