Not sure if I’m doing something wrong but when I cpy pst the basic forms information it doesn’t show up on the Dashboard. I’m trying to create an integer picker but it doesn’t want to work.
If anyone knows how to create an integer picker in Dashboard please let me know
Thanks
Product: PowerShell Universal
Version: 3.0.0
adam
June 30, 2022, 3:35pm
2
The basic form example is for scripts and not dashboards.
Is there a way to create an integer picker for Dashboard Im currently using a textbox and checking if its an integer.
If you are defining the range, and it’s relatively small, you can do this:
New-UDSelect -Id 'Integers' -Option {
1..10 | Foreach-Object {
New-UDSelectOption -Name $_ -Value $_
}
} -Label 'Pick A Number'
Otherwise, if it’s meant to be “any” number, you can throw a validation around the New-UDForm input and fail the input:
New-UDForm -Content {
New-UDTextbox -Id 'Integer' -Placeholder 'Enter a number here'
} -OnSubmit {
If ($EventData.Integer -notmatch "^\d.+$") {
Show-UDToast -Message "Error, not an integer." -Position center -Duration 4000
} Else {
# Proceed with code execution
}
}
Probably better ways to do it, but this is how I have done it in the past.