Skip to content

[dev-v5] fix: change does not trigger validation in FluentSelect #4728

@MarvinKlein1508

Description

@MarvinKlein1508

🐛 Bug Report

When switching the value in FluentSelect then the validation for the current bound value will not retrigger.

Please take a look on this video:

2026-04-20.10-22-11.mp4

💻 Repro or Code Sample

@page "/Debug/Test"
@layout FluentUI.Demo.Client.Layout.EmptyLayout


<div style="padding: 1rem">
    <FluentButton OnClick="Save">Submit</FluentButton>
    <EditForm @ref="_form" Model="Input" OnValidSubmit="OnValidSubmit">
        <DataAnnotationsValidator />
        <FluentValidationSummary />
        <FluentSelect Label="Location"
                      TOption="CompanyLocation"
                      TValue="int?"
                      @bind-Value="@Input.LocationId">
            <FluentOption TValue="int?" Value="@(null)" Text="--- SELECT ---" />
            @foreach (var item in Locations)
            {
                <FluentOption TValue="int?" Value="@item.Id">
                    @item.Name
                </FluentOption>
            }
        </FluentSelect>
        <ValidationMessage For="() => Input.LocationId" />

        <div>
            <label>Location 2</label>
            <InputSelect @bind-Value="@Input.LocationId2">
                <option value="">--- SELECT ---</option>
                @foreach (var item in Locations)
                {
                    <option value="@item.Id">
                        @item.Name
                    </option>
                }
            </InputSelect>
            <ValidationMessage For="() => Input.LocationId2" />
        </div>
    </EditForm>
</div>

@code {
    private EditForm _form = default!;
    public MyInput Input { get; set; } = new();

    Task Save()
    {
        _form.EditContext!.Validate();

        return Task.CompletedTask;
    }

    Task OnValidSubmit()
    {
        return Task.CompletedTask;
    }

    public IEnumerable<CompanyLocation> Locations { get; set; } = new List<CompanyLocation>
    {
        new CompanyLocation { Id = 1, Name = "Germany" },
        new CompanyLocation { Id = 2, Name = "Netherlands" },
        new CompanyLocation { Id = 3, Name = "Belgium" }
    };

    public class MyInput
    {
        [System.ComponentModel.DataAnnotations.Required]
        public int? LocationId { get; set; }

        [System.ComponentModel.DataAnnotations.Required]
        public int? LocationId2 { get; set; }
    }

    public class CompanyLocation
    {
        public int Id { get; set; }
        public required string Name { get; set; }
    }
}
  1. Open the page
  2. Click submit
  3. Notice two validation errors
  4. Switch the value in the native control
  5. See validation message is disappearing
  6. Switch the value in FluentSelect
  7. Notice the validation message is still there.

🤔 Expected Behavior

I expect the FluentSelect to behave exactly like InputSelect in this case.

💁 Possible Solution

🔦 Context

🌍 Your Environment

  • OS & Device: Windows 11 64 Bit
  • Browser latest Firefox, Chrome & Edge
  • latest dev-v5 branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bugv5For the next major version

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions