<![CDATA[ Dynamic Depencency Listboxes - My Forums]]> https://forums.modx.com/thread/?thread=101901 <![CDATA[Dynamic Depencency Listboxes]]> https://forums.modx.com/thread/101901/dynamic-depencency-listboxes#dis-post-549427
I am fairly new to MODx and pretty desperate because i cannot find any working solution to my problem.

I have set up a Listbox(Multiple Choice) with some resources to choose from which i pull with this:
@EVAL return $modx->runSnippet('listResourcePagetitleInputOption', array('parent' => 99));

This works perfectly and lets me choose from the child-elements (100,101,102) of the parent resource with the id 99.

Resource structure:
- Special (99)
-- Option 1 (100)
--- Sub Option 1 (103)
--- Sub Option 1 (104)
-- Option 2 (101)
--- Sub Option 1 (105)
-- Option 3 (102)

Snippet-Code (listResourcePagetitleInputOption):
<?php
$parent = $modx->getOption('parent',$scriptProperties,0);
$parentObj = $modx->getObject('modResource',$parent);
if (!($parentObj instanceof modResource)) { return ''; }
$resArray = $parentObj->getMany('Children');
$resources = array();
foreach($resArray as $res) {
  if ($res instanceof modResource) {
    $resources[] = $res->get('pagetitle');
  }
}
$out = implode("||",$resources);
return $out;


I am in need of a second Listbox which pulls the chosen id (for example id 100) of the first Listbox as his parent id (100) to get the child-elements with the ids 103 and 104 as a selectable option. Also it should be possible if i choose the Option 1 (100) and Option 2 (101) in the first Listbox, it should grab the children of all selected (103,104,105).

Is there a way to achieve this? Any help is greatly appreciated!

Thank you and best regards
Sascha]]>
toblerone Mar 15, 2017, 10:22 AM https://forums.modx.com/thread/101901/dynamic-depencency-listboxes#dis-post-549427
<![CDATA[Re: Dynamic Depencency Listboxes]]> https://forums.modx.com/thread/101901/dynamic-depencency-listboxes#dis-post-549429 https://modx.com/extras/package/dynamicdropdowntv]]> Bruno17 Mar 15, 2017, 12:12 PM https://forums.modx.com/thread/101901/dynamic-depencency-listboxes#dis-post-549429