Get-UDElement breaking change


#1

Adam,

I tried updating my site from 2.2.0 to 2.2.1 and I encountered the same problem with Get-UDElement that I saw when testing 2.3.0.118, breaking most of my site.

Taking the time to investigate further this time, I found the problem.

In 2.2.0, when the UDElement is a UDSelect, Attributes.value is the value of the selected option.
In 2.2.1, when the UDElement is a UDSelect, Attributes.value is the value of the selected option, wrapped in double quotes.

New-UDLayout -Columns 1 -Content {
    New-UDTextbox -ID InputTextbx -Label InputTextbx -Value 'TB Value'
    New-UDSelect  -ID InputSelect -Label InputSelect -Option {
        New-UDSelectOption -Name SelectA -Value 'Select A' } -OnChange {
        Sync-UDElement -Id Output }

    New-UDElement -ID Output -Tag div -Endpoint {
        New-UDTextbox -Id OutputTextBx -Label OutputTextBx -Value ( Get-UDElement -Id InputTextbx ).Attributes.value
        New-UDTextbox -Id OutputSelect -Label OutputSelect -Value ( Get-UDElement -Id InputSelect ).Attributes.value } }

What is the planned behavior for this in 2.3.0 ?

Thanks,
Tim Curwick


#2

This must have been an unintended side effect of a multi-select fix. I will have to investigate this. I think that it shouldn’t have introduced the breaking change so likely the 2.3 implementation will be the same as 2.2.


#3

im using this to fix it :slight_smile:
well this is used on the OnChange script block.

$eventdata -replace ("`"", ‘’)


#4

My workaround is

( [string]( Get-UDElement -Id InputTextbx ).Attributes.value ).Trim( '"' )