havit / Havit.Blazor

Free Bootstrap 5 components for ASP.NET Blazor + optional enterprise-level stack for Blazor development (gRPC code-first, layered architecture, localization, auth, ...)
https://havit.blazor.eu
MIT License
496 stars 67 forks source link

[HxInputDate] Does not work completely with [HxFormState] #877

Closed StarGazer202424 closed 2 months ago

StarGazer202424 commented 2 months ago

Hi

I am using version "4.6.13-pre1" and have found an issue with [HxInputDate] and [HxFormState]

<EditForm Model="@model">
    <DataAnnotationsValidator />

    <HxSwitch Text="Enabled" @bind-Value="@model.Enabled" Hint="Toggle the switch to enabled/disable form state." />

    <HxFormState Enabled="@model.Enabled">
        <HxInputText Label="Text value" @bind-Value="@model.StringValue" Enabled="true" />
        <HxCheckbox Text="Bool value" @bind-Value="@model.BooleanValue" />
        <HxInputDate Label="Date" @bind-Value="@value" Enabled="true" />
        <HxSubmit Text="Validate" Color="ThemeColor.Primary" />
    </HxFormState>

</EditForm>
@code {
    private Model model = new Model();
    public DateTime value { get; set; }
    private class Model
    {
        public bool Enabled { get; set; } = false; // set to false so everything in HxFormState should be disabled unless the control overrides this.

        [Required]
        public string StringValue { get; set; }

        public Boolean BooleanValue { get; set; }
    }
}

Expected Result:

image

hakenr commented 2 months ago

@StarGazer202424 Thank you for reporting this issue. My very first impression after checking the implementation: this is a bug.

StarGazer202424 commented 2 months ago

@StarGazer202424 Thank you for reporting this issue. My very first impression after checking the implementation: this is a bug.

Thanks for checking it out so quickly to determine if it was a bug or not.

hakenr commented 2 months ago

HxInputDateRange was also affected. Fixed in release: 4.6.13-pre3