UDTextbox numer type range

Product: PowerShell Universal
Version: 4.0.0-beta5

Hello
Im getting more frustrated with PU every day :slight_smile:
New ideas new functionality new problems.
This one is simple i guess and will answered quickly
Im using UDTextbox command with number type as parameter that is number of months to add to current date.

New-UDTextbox -Id 'int' -Type number -Label "Months" -Value 12 

And basically its working but the how heck limit range that user is able to change this textbox to positive values in range of 1-12 ??
I tried to use mask but it throws some errors… (maybe im not good at regex anyway)

ok it seems like

 -Mask '/^([1-12]{1,2})$/' 

does the trick but Mask removes those arrows to change numbers ?
Is it any easiest way to do this ?
It should be implemented out of the box for int type values…

If you want months, you could use the month type.

        New-UDTextbox -Type month -OnBlur {
            Show-UDToast $Body
        }

If you want more control over the validation, I’d use -OnValidate rather than a regex.

        New-UDTextbox -Type number -OnValidate {
            $Value = [int]$EventData[0]
            if ($Value -ge 1 -and $Value -le 12)
            {
                New-UDValidationResult -Valid
            }
            else 
            {
                New-UDValidationResult -ValidationError 'Invalid month'
            }
        }

Hello Adam
Thank for reply. Although the solutions that you have given, do the job in some way i think that classic textbox form with arrows to add or subtract values and defined max and minimum range is very common in various web pages and will be useful.
I will create GitHub issue for new enhancement if you don’t mind.