UDSelect -OnChange create new content

Product: PowerShell Universal
Version: 1.4.6
```Hello, I'm using Universal 5.10 with the latest framework. 

I'm trying to create a flow where by a user selects a network name, then sees the ranges in that network. I then want them to be able to find the next free IP in that range.  All the code to do this is ready. Now I'm just working on the UI. 

I've created a UDSelect that shows the list of networks.  My plan was use a UDRadioGroup next to show the ranges in those networks.   But when I use the Onchange event in the UDSelect, I don't seem to be able to figure out how to dynamically add this Radio Group. 

Here's the code. Minus the functions that get's the network information as they aren't necessary.  I am quite sure I'm going about this all wrong.  I've tried just putting the UDRadioGroup into the onChange event block but that doesn't work either. So I tried creating a DynamicContent area then embedding the function to create the RadioGroup within that.  Still no joy. 

<Code>
$Zones = Get-NetworkZoneList
New-UDSelect -Option {
    ForEach ($Network in $Zones) {
        New-UDSelectOption -Name $Network.Zone -Value $Network.Zone
    }   
} -OnChange {
    $Message = "Retrieving ranges for " + $EventData
    Show-UDToast -Message $Message # I know I don't need to use a variable here.  I had my reasons at the time. 
    $Ranges = Get-NetworkIPRangesInZone -ZoneName $EventData        
    PopulateRanges -Range $Ranges
}

New-UDDynamic -Id 'ranges' -Content {
    Function PopulateRanges {
        param
        (
            [Parameter(Mandatory = $true, Position = 0)]
            [array] $Range
        )
    }    
    # New-UDRadioGroup -Label 'Ranges' -Id "Ranges" 
    New-UDTable -Data $Range
    Sync-UDElement -Id 'ranges' }
}
    
}
</code>

I welcome alternative approaches.

There was an error in that code. VSCode was over eager to add closing brackets. But this isn’t the cause of my trouble. Here’s another approach that I’ve tried to take to make new content load when an option is selected. However, this doesn’t work either.

$DCUZones = Get-NetworkZoneList New-UDSelect -Option { ForEach ($Network in $Zones) { New-UDSelectOption -Name $Network.Zone -Value $Network.Zone } } -OnChange { $Message = "Retrieving ranges for " + $EventData Show-UDToast -Message $Message $Ranges = Get-NetworkIPRangesInZone -ZoneName $EventData Sync-UDElement -id "ranges" Sync-UDElement -id "RangeList" }

New-UDDynamic -Id ‘ranges’ -Content {
New-UDRadioGroup -Id “RangeList” -Label “Ranges” -Content {
ForEach ($Range in $Ranges.Range) {
New-UDRadio -Label $Range -Value $Range
}
}
}

@Darragh - You need to sync ranges rather than RangeList. It will cause the UDDynamic to relate with the ranges.

$DCUZones = Get-NetworkZoneList 
New-UDSelect -Option { 
    ForEach ($Network in $Zones) { 
           New-UDSelectOption -Name $Network.Zone -Value $Network.Zone 
    } 
} -OnChange { 
     $Message = "Retrieving ranges for " + $EventData 
      Show-UDToast -Message $Message 
      $Ranges = Get-NetworkIPRangesInZone -ZoneName $EventData 
      Sync-UDElement -id "ranges" Sync-UDElement -id "ranges" 
}
New-UDDynamic -Id ‘ranges’ -Content {
       New-UDRadioGroup -Id “RangeList” -Label “Ranges” -Content {
              ForEach ($Range in $Ranges.Range) {
                   New-UDRadio -Label $Range -Value $Range
             } 
        }
}