Radzen Autocomplete Reset

Hello,

I am looking for a way to reset a Autocomplete field on my form. The use case being if someone types in a value which is not in the autocomplete list and then tabs away, i want to reset the searchText to be null instead of retaining the inaccurate information that was typed. That way they can go back to the field and start from nothing to search for a new item in the drop down.

Is there a way to do this already that i am missing? I have tried to register an onfocusout function but i cannot seem to find a way to reset the searchText to null.

Thanks in advance!!

1 Like

You should set the Value of the AutoComplete component. If you are using @bind-Value already - you can handle the Change event of the AutoComplete and reset the model value there.

I have tried something similar to this because i am using the Change event already, but i have noticed that the change event doesnt get called when the value input is not a valid option in the autocomplete and also because the option wasnt valid, the @bind-Value remains null.

Hi @alien8tr96,

You are right about Change event - it will be fixed in the next update (Monday).

@enchev
Thanks! I look forward to the update and implementing the change for my feature! Great Library!