How to clear New-UDAutocomplete fileld

Product: PowerShell Universal
Version: 4.0.0-beta5

Ive got a simple form that have New-UDSelect with two domains to choose and New-UDAutocomplete where you can browse users depending on domain.
And the simple question is how to clear previously selected user account when I change domain
Simple code

-OnChange {
                    Set-UDElement  -id service_account -Attributes @{value = $null}
                }

Do not work for New-UDAutocomplete

A little progress.
Setting value to “”

Set-UDElement  -id service_account -Attributes @{value = ""}

actually clears this filed but I have to click on it to remove value
So basically i cant “refresh” UDAutocomplete value - how to do that ?

PS. Strange issue is, when I wrap it in New-UDElement and sync, whole UDAutocomplete form disappears :slight_smile:
PS2 . although i can clear display value by click on it $Eventdata on validate still have old value so its no good fix :frowning:

We have next progress

Set-UDElement  -id service_account -Attributes @{key = ''}

Does the job perfectly. Validate is working (there is warning). value of form is cleared.

But there is one nuance. It works only 1 time.
I have domain1 as default option - i choose account.
I change domain to domain2 - udautocomplete is cleared. validate working (warning)
I chose some account from domain2.
I change domain to domain1. account is still chosen. validate is not working (no warning)

PS. looks like we have a working solution
i had to wrap this udautocomplete in New-UDDynamic
then i call

Set-UDElement  -id service_account -Attributes @{value = ''}
Set-UDElement  -id service_account -Attributes @{key = $null}
Sync-UDElement -Id 'service_account_auto'
                

and it works every time :slight_smile: