New-UDIcon -Solid, New-UDTextbox -OnValidate, New-UDAlert as toast? and more

Product: PowerShell Universal
Version: 3.7.6

I have found a couple of issues in the latest version:

New-UDIcon still defaults to using the solid versions of icons, discussed here:
Icon Solid version - PowerShell Universal - Ironman Software Forums
They don’t seem to work in Show-UDToast (already mentioned here: Show-UDToast: Icon does not show · Issue #1913 · ironmansoftware/issues · GitHub )


Also, what does -Inverse do for New-UDIcon? When using this, I can only see the icons in dark mode.


Regarding New-UDTextbox -OnValidate, in the documentation the following example is used:

New-UDTextbox -OnValidate {
    if ($EventData.Length -lt 10)
    {
        New-UDValidationResult -Error 'String needs to be longer than 10'
    }
}

This will never clear the error if the input is changed to a correct one.
Adding a New-UDValidationResult -Valid, like this:

New-UDTextbox -OnValidate {
    if ($EventData.Length -lt 10)
    {
        New-UDValidationResult -Error 'String needs to be longer than 10'
    }
    else{
        New-UDValidationResult -Valid
    }
}

Will show a small text below the Textbox, “Form is invalid”.

The only current workaround I found is:

New-UDTextbox -OnValidate {
    if ($EventData.Length -lt 10)
    {
        New-UDValidationResult -Error 'String needs to be longer than 10'
    }
    else{
        New-UDValidationResult -Valid ""
    }
}

A feature that might be interesting is to be able to use the New-UDAlert as a Toast.
There are several different ways this could be done, but I would find it usefull, instead of creating my own Show-UDToast similar to New-UDAlert.

  • Add “Severity” to Show-UDToast (defauls to $null)
  • Create a new command “Show-UDToastAlert”

Currently I am using

NavigationLayout = "permanent"
LoadNavigation   = $NavigationBar

when starting the dashboard. Would it be possible to make the navigation bar not reload every time you access a different page?


And lastly, what does the new -Menu option do for New-UDDashboard?
I (think I) have tried every possible combination, but I see no change on my dashboard.

for me i had to do this:

New-UDTextbox -Id "BetriebLDITextboxVerfahrensspeicherort" -Label "Speicherort für die Verfahrensdaten" -Icon $IconVerfahrenOrdner -Value $Verfahrensort -FullWidth -OnValidate {
    if (!(($Eventdata -like "W:\*") -or ($Eventdata -like "X:\*"))) {
        New-UDValidationResult -ValidationError 'Speicherort muß mit W:\ oder X:\ anfangen!'
    } else {
        New-UDValidationResult -Valid ''
    }
}

Error isnt a option. ValidationError works.

I’ll note that it defaults to the open version of the icons. There is now a -Solid parameter if you want to get the solid version. I am using that successfully on 3.7.7.

Yes, it seems like I was to hasty here.
I was trying to copy New-UDAlert, which has different icons than are availbale by Font Awesome it seems.

The issue is not the “-Error”, it was that only “New-UDValidationResult -Valid” does not work, but you need to add text (blank) at the end.

After som additional work I have also noted that “New-UDTextbox -OnValidate” is ignored if -OnEnter is used.
It also seems to use the “OnEnter” when focus is removed from the textbox (unsure if this is the normal behavior).