Can't retrieve data From UDSelect using Get-UDElement

Hi everyone

i’m having issues retrieving data from a UDSelect using Get-UDElement

i’m not able to retrieve any data form a Select ( with a textbox it works right).
I’ve tried other solution but it’s not working.

New-UDTableColumn -Property Role -Title Role -Render { 
       
        New-UDSelect -Id 'selectRole' -Option $selOptions 
    }
)

New-UDTable -Title "Computer Onboarding" -Data $Data -Columns $Columns -Sort -Export



New-UDButton  -Text 'OnBoard' -OnClick {
 
   
    $value = (Get-UDElement -Id 'selectRole')["Value"]
    Show-UDToast -Message $value -Text "Get textbox value"
  
}

i’ve tried :
Get-UDElement -Id ‘selectRole’).Attributes.value
Get-UDElement -Id ‘selectRole’).Attributes.[“Value”]

Without any luck

Are there better ways to retrieve data from a UDSelect?

Thanks in Advance

Product: PowerShell Universal
Version: 1.4.9

I tested on the latest 1.5 build but this should work on 1.4.9.

New-UDDashboard -Title 'Test' -Content {
  New-UDSelect -Option {
      New-UDSelectOption -Name 'One' -Value 1
      New-UDSelectOption -Name 'Two' -Value 2
      New-UDSelectOption -Name 'Three' -Value 3
  } -Id 'nice'

  New-UDButton  -Text 'OnBoard' -OnClick {
    Show-UDToast -Message (Get-UDElement -Id 'nice' | ConvertTo-Json)
    Show-UDToast -Message (Get-UDElement -Id 'nice').value
  }
}

The one issue I’m seeing is that if you haven’t changed from the default value, then value is blank. Once I select an option, then I can use Get-UDElement to grab it. I’ll open an issue for this.

For now, you can set the default value and assume that if the value is null, then use defaultValue.

New-UDDashboard -Title 'Test' -Content {
  New-UDSelect -Option {
      New-UDSelectOption -Name 'One' -Value 1
      New-UDSelectOption -Name 'Two' -Value 2
      New-UDSelectOption -Name 'Three' -Value 3
  } -Id 'nice' -DefaultValue 2

  New-UDButton  -Text 'OnBoard' -OnClick {
    $Element = Get-UDElement -Id 'nice'
    if ($Element.Value)
    {
      Show-UDToast -Message $Element.Value
    }
    else 
    {
      Show-UDToast -Message $Element.DefaultValue
    }
  }
}

Thanks Adam that seems to be working fine,
i Thought that maybe populating the Select content dynamically could be the issue.
Thanks