Set The Selected Index of A UDSelect

Perhaps there is a way to do this currently, but if so, I’ve not found it. What I’d like to do is programmatically set the currently selected index or value of a UDSelect. This would help greatly with setting up default values in fields which increases speed and usability for my users. Something like the below would be excellent.

New-UDSelect -Id 'testSelect' -Label 'Test Select' -Option {
    New-UDSelectOption -Name 'Option1' -Value 'option1'
    New-UDSelectOption -Name 'Option2' -Value 'option2'
} -SelectedIndex 1

# Or...

Set-UDElement -Id 'testSelect' -Attributes @{'selectedIndex' = 1}

Not index, but -DefaultValue will match a string

in the snippet below, $BlueCollarWorkArea will contain one of the two possibilities in the -Values parameter, and will reflect that in the form.

New-UDInputField -Type select -Name 'WorkingArea' -Placeholder 'Working Area' -Values @("BC Production","BC Construction") -DefaultValue $BlueCollarWorkArea

Unsure if this is of any use, but this is how I set a “Default” value from a cached list.

New-UDInputField -Type 'select' -Name 'Client' -Placeholder 'Choose a Client' -Values @($Cache:Clients.Name) -DefaultValue @($Cache:Clients.Name[0])