Can you modify ICON attributes of an UDelement that uses Icon?

Can you modify ICON attributes of an UDelement that uses Icon?

avatar
(anonymous user)
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)


0468375a077abec13c2804e7c9a8c7d221eaf05d


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:
5e2e8c4e8f6d94874fe97d94131126eeaf506852


Or even better, only show a red arrow icon if the UDSelect has no value set.

5e2e8c4e8f6d94874fe97d94131126eeaf506852.png

0468375a077abec13c2804e7c9a8c7d221eaf05d.png

All Comments (1)

avatar

Solved it by using

    Set-UDElement -id "txtGroup$id" -Properties @{ Icon = (New-UDIcon -Icon Check -Style @{ color = 'red'}) }