Skip to content

bug(AutoComplete): trigger ValueChanged when the Value changed #5480

@celadaris

Description

@celadaris

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Testing ValueChanged doesnt work. When i type in the AutoComplete form it doesn't trigger the attached function. instead it kind of works like OnBlurAsync

Expected Behavior

When i type in the AutoComplete form it should trigger the attached function.

Interactive render mode

Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)

Steps To Reproduce

I downloaded the github source and modified index.razor to this:

@layout HomeLayout
@page "/"
@page "/index"
@page "/home"
@using System.Diagnostics
@inject IOptionsMonitor<WebsiteOptions> WebsiteOption

<h1>@testValue</h1>

<ValidateForm Model="sampleModel" OnInvalidSubmit="Invalid" OnValidSubmit="Valid" DisableAutoSubmitFormByEnter="true">
    <AutoComplete ValueChanged="hello" OnEnterAsync="hello"></AutoComplete>
</ValidateForm>

<AutoComplete ValueChanged="hello" OnEnterAsync="hello"></AutoComplete>

<Button Text="TestBtn" OnClick="@(() => hello("hi"))"></Button>

@code {
    SampleModel sampleModel = new SampleModel();
    int testValue = 0;

    async Task hello(string value)
    {
        testValue++;
        await InvokeAsync(StateHasChanged);
        //Debugger.Break();
    }

    async Task Valid(EditContext context)
    {
        //Debugger.Break();
    }

    async Task Invalid(EditContext context)
    {
        //Debugger.Break();
    }

    class SampleModel()
    {
        public string Input { get; set; } = string.Empty;
    }
}

Exceptions (if any)

No response

.NET Version

NET8.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions