2.3.1 bug - Get-UDElement

Adam,

Get-UDElement is broken for UDSelect objects. A UDElement object is returned, but the Attributes property is null.

Get-UDElement works as expected for UDTextbox objects.

Thanks,
Tim Curwick

I am seeing the same behavior with 2.3.1

I can return UDTextbox objects, but am unable to return UDSelect object.

Looks like a fix is done and will be part of 2.3.2.

I’m being a complete pain in the behind here - is there an alternate way to get the value of the UDSelect after it has changed?

I haven’t tested it, but I would try somethiing like this.

New-UDSelect ... -OnChange { $Session:Selection = $EventData }

New-UDButton ... -OnClick { If( $Session:Selection.Trim( '"' ) -eq 'Lunchtime' ) { 'Awesome' } }

Tim -

Thank you for the suggestion.

I had tried something similar - the $EventData on a UDSelect returns the value/Number of the item in the Selection. I’m dynamically building the Items in several of my SelectBoxes. I guess I can push those dynamic items out to an array and pick it out of the array later. I’m just feeling lazy, and would prefer to get the contents of the Selectbox.

Kirk.

I have tested an early build of v2.3.2, and it is fixed. It should be released soon.

:grinning:

Awesome! I have so many plans for this… hah! Our in house developers C# are shaking their heads at this. I will show them!

@MadWithPowerShell, have you run across this issue again recently?

I believe this bug has reappeared in 2.4.1 (the current full release, I believe). I’m unable to get the value of a UDSelect when Get-UDElement is called within the -OnClick handler of a button. It should be noted that I can get the value when I call Get-UDElement from the -OnChange handler of New-UDSelect, however.

Working example:

New-UDSelect -Id 'test-select' -Option {
    New-UDSelectOption -Name 'test' -Value 'stuff'
    New-UDSelectOption -Name 'another test' -Value 'other stuff'
} -OnChange {
    Show-UDToast -Message (Get-UDElement -Id 'test-select').Attributes['value'] -Title 'Debug' -Position topRight -Duration 6000
}

Broken Example:

New-UDSelect -Id 'test-select' -Option {
    New-UDSelectOption -Name 'test' -Value 'stuff'
    New-UDSelectOption -Name 'another test' -Value 'other stuff'
}

New-UDButton -Id 'test-btn' -Text 'Click Me!' -OnClick {
    Show-UDToast -Message (Get-UDElement -Id 'test-select').Attributes['value'] -Title 'Debug' -Position topRight -Duration 6000
}

Jon,

I have not yet upgraded to 2.4.1. I only have one site in production at the moment, and I haven’t had to touch it since it went live on v 2.3.2.

Thanks,
Tim Curwick

1 Like