I'm trying to create a chain from many input components. But if I use the last one, the validation message doesn't show in component, but validation summary looks good.
- InputTextOnInput (https://www.meziantou.net/validating-an-input-on-keypress-instead-of-on-change-in-blazor.htm)
@inherits InputText<input class="@CssClass" value="@CurrentValue" @oninput="EventCallback.Factory.CreateBinder<string>(this, value => CurrentValueAsString = value, CurrentValueAsString)" />- InputFloatingLabel
@using System.Linq.Expressions<div class="form-floating mb-3"> @ChildContent<label for="@LabelForId">@Label</label><div class="invalid-feedback"><ValidationMessage For="@ValidationMessageFor"/></div></div>@code { [Parameter] public string LabelForId { get; set; } = string.Empty; [Parameter] public string Label { get; set; } = string.Empty; [Parameter] public Expression<Func<object>>? ValidationMessageFor { get; set; } [Parameter] public RenderFragment? ChildContent { get; set; }}- InputTextFloatingLabel
@using System.Linq.Expressions<InputFloatingLabel LabelForId="@Id" Label="Адрессервера" ValidationMessageFor="@ValidationMessageFor"><InputTextOnInput @bind-Value="@Value" id="@Id" class="form-control" @bind-Value:after="OnValueChanged"/></InputFloatingLabel>@code { [Parameter] public string? Value { get; set; } [Parameter] public string Id { get; set; } = string.Empty; [Parameter] public string Label { get; set; } = string.Empty; [Parameter] public Expression<Func<object>>? ValidationMessageFor { get; set; } [Parameter] public EventCallback<string?> ValueChanged { get; set; } private async Task OnValueChanged() { await this.ValueChanged.InvokeAsync(Value); }}- parent component
<InputTextFloatingLabel @bind-Value="DatabaseConnection.Host" Id="input-db-host" Label="Host" ValidationMessageFor="() => DatabaseConnection.Host" />If I use InputFloatingLabel in parent component - all works fine.Could you please help me, how to show validation message when the InputTextFloatingLabel is usend in parent?
I'm tried to use CascadeParameter EditContext and NotifyFieldChanged