Validators aren't firing for DatePickers

Hi everyone,

I've run into an issue with validators on DatePicker components. In a template form, I have a number of fields. Some have attached validators.

The validators for these fields work:

<div class="row mb-4">
        <div class="col">
            <RadzenLabel Class="font-weight-bold text-muted" Component="Name" Text=@Loc["Name"] />
            <RadzenTextBox Class="d-block w-100" id="@nameof(SmsBroadcast.Name)"
                           Name="Name" @bind-Value="@form.Name" />
            <RadzenRequiredValidator Component="Name" Text=@Loc["nameRequired"] Style="position: absolute" />
        </div>
    </div>
<div class="row mb-4">
        <div class="col">
            <RadzenLabel Class="font-weight-bold text-muted" Component="Body" Text=@Loc["Body"] />
            <SmsTextArea Class="d-block w-100" Name="Body" @bind-Value=@form.Body ShowInfo=true />
            <RadzenRequiredValidator Component="Body" Text=@Loc["bodyRequired"] Style="position: absolute" />
        </div>
    </div>

The validators for the DatePickers do not:

<div class="row mb-4">
        <div class="col-6">
            <RadzenLabel Component="StartDate" Text=@Loc["startDate"] />
            <RadzenDatePicker AllowClear="true" class="d-block w-100 mb-2" TValue="DateTime" @bind-value=@form.StartDate Name="StartDate" ShowTime="false" DateFormat="yyyy-MM-dd" />
            <RadzenRequiredValidator Component="StartDate" Text=@Loc["startDateRequired"] Style="position: absolute" />
            <RadzenCompareValidator Text=@Loc["noPastStart"] Value=@(DateTime.UtcNow) Component="StartDate" Style="position: absolute" Operator="CompareOperator.GreaterThanEqual" />
            <RadzenCustomValidator Text=@Loc["noPastStart"] Component="StartDate" Style="position: absolute" Validator="@(() => StartDateInFuture(form.StartDate))" />
        </div>
        <div class="col-6">
            <RadzenLabel Component="EndDate" Text=@Loc["endDate"] />
            <RadzenDatePicker AllowClear="true" class="d-block w-100 mb-2" TValue="DateTime" @bind-value=@form.EndDate Name="EndDate" ShowTime="false" DateFormat="yyyy-MM-dd" />
            <RadzenRequiredValidator Component="StartDate" Text=@Loc["startDateRequired"] Style="position: absolute" />
            <RadzenCompareValidator Visible="true" Text=@Loc["noEndBeforeStart"] Value=@form.StartDate Component="EndDate" Style="position: absolute" Operator="CompareOperator.LessThanEqual" />
        </div>
    </div>

There are no log messages or browser console messages.

Have I made an obvious mistake that I'm missing? Has anyone else run into a problem like this?

Thanks!

This syntax is not correct - should be @bind-Value.

1 Like

Thanks! I thought it might be something obvious I was overlooking. Good catch on the casing of that V!