New-UDTextBox not updating when setting the ID parameter

New-UDTextBox not updating when setting the ID parameter

avatar
(anonymous user)
Product: PowerShell Universal
Version: 4.2.8


Hey guys and gals,

Pretty new to this PSU stuff, and I’m having a little issue that I can’t seem to solve!

Here’s my code that works:

Set-UDElement 'tree' -content {
                    Get-ADOrganizationalUnit -Filter * -Server mydomaincontroller.my.domain.com.au -Searchbase 'OU=OUName,DC=my,DC=domain,DC=com,DC=au' -SearchScope 1 -Properties canonicalname,distinguishedname | select name,canonicalname,distinguishedname | sort name | ForEach-Object {
                        New-UDTreeView -Id 'selectOU' -Node { New-UDTreeNode -Name $_.Name -Id $_.DistinguishedName } -OnNodeClicked {
                            Get-ADorganizationalUnit -Filter * -Searchbase $EventData.id -SearchScope 1 -properties canonicalname,distinguishedname | select canonicalname, distinguishedname,name | ForEach {
                            New-UDTreeNode -Name "$($_.Name)" -Id "$($_.distinguishedname)" -Leaf:$(-not $_.distinguishedname)
                        }
                        $Global:Value = $EventData.id
                        Set-UDElement 'SelectedOU' -Content {
                            New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder'
                        }
                        Show-UDToast $Global:Value
                        }


With this code, the Toast and the Text Box shows the OU selected, even if it’s a child OU.

However, if I add the following to the New-UDTextBox it will only EVER show the parent OU in the text box and stored in the value, but will show the child OU selected in the Toast:

 Set-UDElement 'SelectedOU' -Content {
                            New-UDTextbox -Value $Value -Label "Selected OU" -FullWidth -Icon 'folder' -id 'wheretoput'
                        }


Literally just putting an ID parameter on the text box stops it from showing what I need it to. Is this a bug?

If I don’t add the ID parameter, it labels the field as a random GUID and I can’t use that parameter to pass to the script that runs after the information has been collected.

Hopefully all of this makes sense!

Cheers,

Dave

All Comments (4)

avatar

Looks like a similar problem to these

My Table is with Columns parameter - the Table is not refreshing its data.
I just tried this myself with this sample and the table updates without having to set the loading component. New-UDDynamic -Content { $Data = @( @{Dessert = 'Frozen yoghurt'; Calories = Get-Random; Fat = 6.0; Carbs = 24; Protein = 4.0 } @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 } @{Dessert = 'Eclair'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0 } @{Dessert = 'Cupcake'; Calories = 15…

There is something about having an ID on something inside of a dynamicic region that breaks the update functionality

avatar

Yeah, looks like that’s the issue - I’m wondering that as it’s been around for a while why it hasn’t been fixed.

@Adam Driscoll - can you confirm this seems to be a bug and whether it’s being looked at?

avatar

Looks like there is an issue open on the git repository

github.com/ironmansoftware/issues

avatar

As a workaround, you can store the dynamically generated ID in a variable and reference that