Hello,
When no choice is made on a drop-down list where a value is preselected it is not possible to find the value with Get-UDElement.
Is it a bug or a bad coding on my part?
My version of Universal Dashboard : 2.7.0
Here is my code :
$Cache:Companies = @("A", "B", "C", "D", "E", "F", "G")
New-UDPage -Url "test" -Title "Test" -Endpoint {
$Company = "D"
New-UDSelect -Id "select" -Label "Company" -Option {
$Cache:Companies | ForEach-Object {
if ($_ -eq $Company)
{
New-UDSelectOption -Name $_ -Value $_ -Selected
}
else
{
New-UDSelectOption -Name $_ -Value $_
}
}
} -OnChange {
Show-UDToast -Title "onchange" -Message $EventData
}
New-UDButton -Text "test" -OnClick {
$Test = (Get-UDElement -Id "select").Attributes['value']
Show-UDToast -Title "button" -Message $Test
}
}