havit/Havit.Blazor

[HxInputDate] Does not work completely with [HxFormState]

Closed this issue · 3 comments

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:

  • InputText will be enabled as it has been set to always be True - Pass
  • Checkbox will be only enabled or disabled based on switch, On load it will be Disabled - Pass
  • HxInputDate will be enabled as it has been Set to always be True - Pass
  • HxINputDate calendar popup will be enabled as it part of the control - Fail Today & Clear are disabled

image

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

@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.

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