Product: PowerShell Universal
Version: 4.3.2
I have a Form that uses a New-UDSelect that is populated with values, but if none of the options are selected, it should give a validation error, which it does, but I want to highlight the UDSelect that has the error.
New-UDSelect -Id "txtGroup$id" -FullWidth -Label 'Group' -Option {
$session:fsTicketFieldsChoices["group"].choices | ForEach-Object {
New-UDSelectOption -Name $_.value -value $_.id
}
} -Defaultvalue $session:fstabs[$id].group -Icon (New-UDIcon -Icon ArrowRight)
So far, so great - the form states that “Group” is not set.
However, I am unable to highligt the UDSelect using
if ( [string]::IsNullOrEmpty($FormContent.$("txtGroup$id")) ) {
$invalidForm += "Group "
Set-UDElement -id "txtGroup$id" -Attributes @{ style = @{ 'background-color' = 'red' } }
Set-UDElement -id "txtGroup$id" -Content { New-UDIcon -Icon ArrowRight -Style @{ color = 'red' } }
}
Kind of like this:
Or even better, only show a red arrow icon if the UDSelect has no value set.