Loop through UDElement to get checkbox labels and check status

I’m adding check-boxes programmatically into an element. I’d like to be able to query the checkbox labels and check status on submit or button click.

$chkGroups = [System.Collections.ArrayList]@();    

New-UDCard -Title "Groups" -Content {
            New-UDElement -Id eGroups -Tag div -Endpoint {
                foreach ($group in $chkGroups) {
                    New-UDCheckbox -Label $group -Checked 
                $eGroups = Get-UDElement -Id "eGroups"

If I use the dashboard console, Get-UDElement -Id “eGroups” is indeed returning the check-boxes in a string. The Ids for the check-boxes are guids and I can’t figure out how to loop over the returned string and get at my check boxes. Also, in the above example, my variable $eGroups is allways empty.



I’m doing something similiar to this:

$chkGroups = @(
    'DL-CityHall' )

$Session:SelectedGroups = @{}

New-UDCard -Title "Groups" -Content {
    New-UDElement -Id eGroups -Tag div -Endpoint {
        ForEach ( $Group in $chkGroups )
            New-UDCheckbox -Label $Group -OnChange ( [scriptblock]::Create( "
                `$Session:SelectedGroups['$Group'] = `$EventData" ) )
            } } }

$Checked = $Session:SelectedGroups.Keys | Where-Object { $Session:SelectedGroups[$_] }

Tim Curwick