Can't retrieve data From UDSelect using Get-UDElement

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
    }
  }
}