markdomansky / WebJEA

WebJEA - Secure Self Service Web Forms from PowerShell Scripts
GNU General Public License v3.0
236 stars 27 forks source link

Variable ValidateSet #61

Open dwestness opened 3 years ago

dwestness commented 3 years ago

I would like to have a drop-down field that lists available values from a variable dataset

E.g. "Please Select an Active Directory Users:"

I thought perhaps i could use the on-load script to run my Get-ADUser command and store the options in an array variable that could be passed to the actual script, but that doesn't work in any way.

The only thing i can think of at this point is to have the on-load script actually Edit/Modify the script itself to replace the validateset with my requirements, but that seems unrulely.

When i attempt something like this, the option is just presented as "$Users" (explicit string). Is there a way to Expand this into an actual list of User names?

[Parameter(Mandatory, HelpMessage='Select A User:')]
[ValidateSet($Users)]
[string]$User
markdomansky commented 3 years ago

Dynamic parameters are not currently possible.